Results 1 to 3 of 3
Thread: unclear what i missing
- 04-13-2011, 07:58 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 18
- Rep Power
- 0
unclear what i missing-SOLVED
hey peops wonder if someone can help getting cant find symbol - constructor Taxi but as far as i can see it there it will prob be a semi colon or bracket missing but i cant see it i have attached the code which is not complete but should be fine for section concerned and also the code for the taxi class hope someone can shed light on it.
and the taxi class code which compiles okJava Code:import java.util.Scanner; class C22TaxisP2 { //main taxis menu //Menu method public static String getMenuOpt() { Scanner input = new Scanner(System.in); String option="0"; System.out.println("C22 Taxis Main Menu"); System.out.println("-------------------"); System.out.println("1.add Taxi Details."); System.out.println("2.add Journey Details."); System.out.println("3.Change Taxi Details."); System.out.println("4.Change Journey Details."); System.out.println("5.list all or single Taxi Details"); System.out.println("6.list all or Single Journey "); System.out.println("0.quit"); option = input.next(); return option; } //get all taxis method public static void listTaxis(Taxi taxis[], int taxisInRanks) { int count=0; for(count=0; count< taxisInRanks; count++) //System.out.println("Listing Taxis..." + count); { System.out.print(taxis[count].getNo()+" "); System.out.print(taxis[count].getReg()+" "); System.out.print(taxis[count].getSeats()+" "); System.out.print(taxis[count].getServ()+" "); System.out.print(taxis[count].getLoco()+" "); System.out.println(); } } //get all Journeys method public static void listJourney(Journey journeys[], int journeysBooked) { int count=0; for(count=0; count< journeysBooked; count++) //System.out.println("Listing Journeys..." + count); { System.out.print(journeys[count].getDate()+" "); System.out.print(journeys[count].getTaxiNo()+" "); System.out.print(journeys[count].getDriver()+" "); System.out.print(journeys[count].getPax()+" "); System.out.println(journeys[count].getFrom()+" "); System.out.println(journeys[count].getTo()+" "); System.out.println(journeys[count].getCost()+" "); System.out.println(); } } public static void main(String [] args) { Scanner input = new Scanner(System.in); Taxi taxis[] = new Taxi[10];//array to store 10 taxi details int taxisInRank =0; String TaxiNo, TaxiReg, TaxiServ, TaxiLoco; String TaxiSeats="0"; String choice="0"; Journey journeys[] = new Journey[10];//array of 10 journeys int journeysBooked = 0; String journeyDriver, journeyFrom, journeyTo; String journeyDate="0"; String journeyTaxiNo="0"; String journeyPax="0"; String journeyCost="0"; //call the menu choice = getMenuOpt(); while(!choice.equals("0")) { if(choice.equals("1")) { //get book details System.out.print("Enter the Taxi Number. "); TaxiNo = input.next(); System.out.print("Enter the Taxi Registration(without spaces) "); TaxiReg = input.next(); System.out.print("Is this taxi in service(Y/N) "); TaxiServ = input.next(); System.out.print("Enter the Taxi Location. "); TaxiLoco = input.next(); //creat a new object called taxi 1 based on the taxi class taxis[taxisInRank] = new Taxi(TaxiNo, TaxiReg, TaxiServ, TaxiLoco); taxisInRank++; System.out.println("Taxi object created"); System.out.println(); } getMenuOpt(); if(choice.equals("2")) { //get Video details System.out.print("Enter the title for the Video "); videoTitle = input.next(); System.out.print("Enter the subject for the Video "); videoSubject = input.next(); System.out.print("Enter the date YYYY for the video "); videoPubDate = input.next(); System.out.print("Enter the author for the video "); videoDirector = input.next(); System.out.print("Enter the catalogue number for the video "); catNumber = input.next(); //creat a new object called video 1 based on the video class videos[videosInLibrary] = new Video(videoTitle, videoSubject, videoPubDate, videoDirector, catNumber); videosInLibrary++; System.out.print("Video object created"); System.out.println(); } if(choice.equals("3")) { System.out.println("List books here..."); listBooks(books, booksInLibrary); } if(choice.equals("4")) { System.out.println("list videos here..."); listVideos(videos, videosInLibrary); } if(!(choice.equals("1")||choice.equals("2")||(choice.equals("3")||(choice.equals("4"))))) { System.out.println("Bad Choice, Chose 1,2,3,4 or 0"); } choice = getMenuOpt(); } //choice 0 System.out.println("Goodbye..."); } }
thanks in advanceJava Code://Taxi class class Taxi { private String No; private String Reg; private String Seats; private String Serv; private String Loco; //constructor Taxi (String n, String r, String s, String ser, String l) { No = n; Reg = r; Seats = s; Serv = ser; Loco = l; } //method to get title and date String getNo() { return No; } String getReg() { return Reg; } String getSeats() { return Seats; } String getServ() { return Serv; } String getLoco() { return Loco; } }Last edited by silverspoon34; 04-13-2011 at 08:12 PM. Reason: solved
- 04-13-2011, 08:06 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Your Taxy class has a constructor that takes five Strings, not four.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 04-13-2011, 08:11 PM #3
Member
- Join Date
- Nov 2009
- Posts
- 18
- Rep Power
- 0
Similar Threads
-
method unclear
By marie in forum New To JavaReplies: 0Last Post: 03-21-2010, 01:57 PM -
Help; Missing JButtons
By Cyprusice in forum New To JavaReplies: 3Last Post: 01-10-2010, 11:50 PM -
Missing Elements
By princess in forum NetBeansReplies: 1Last Post: 10-29-2008, 11:51 PM -
Unclear Requirement from client ... Ring a bell?
By galford23 in forum New To JavaReplies: 7Last Post: 01-08-2008, 05:31 AM -
is it bug? or am i missing a point?
By blowguy in forum Threads and SynchronizationReplies: 1Last Post: 11-20-2007, 06:19 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks