Results 1 to 3 of 3
  1. #1
    silverspoon34 is offline Member
    Join Date
    Nov 2009
    Posts
    18
    Rep Power
    0

    Default 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.
    Java 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...");
        }
    }
    and the taxi class code which compiles ok

    Java 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;
    }
    }
    thanks in advance
    Last edited by silverspoon34; 04-13-2011 at 08:12 PM. Reason: solved

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,309
    Blog Entries
    7
    Rep Power
    20

    Default

    Your Taxy class has a constructor that takes five Strings, not four.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    silverspoon34 is offline Member
    Join Date
    Nov 2009
    Posts
    18
    Rep Power
    0

    Default unclear what i missing

    oh yeah think i have spent so many hours typing this that it time to put it away for day before making silly mistakes

Similar Threads

  1. method unclear
    By marie in forum New To Java
    Replies: 0
    Last Post: 03-21-2010, 01:57 PM
  2. Help; Missing JButtons
    By Cyprusice in forum New To Java
    Replies: 3
    Last Post: 01-10-2010, 11:50 PM
  3. Missing Elements
    By princess in forum NetBeans
    Replies: 1
    Last Post: 10-29-2008, 11:51 PM
  4. Unclear Requirement from client ... Ring a bell?
    By galford23 in forum New To Java
    Replies: 7
    Last Post: 01-08-2008, 05:31 AM
  5. is it bug? or am i missing a point?
    By blowguy in forum Threads and Synchronization
    Replies: 1
    Last Post: 11-20-2007, 06:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •