I've noticed several things of concern in your code:
In your airline class you have two distinct objects, reserveSeat an object of Reservation Class) and seatingClass an object of SeatingChart Class which is a child of the Reservation class. When you are adding reservations, all of your interactions are with the reserveSeat object, never with the SeatingClass object. The seatingClass object can't output any useful information if no information has been stored into it. I don't see the purpose that the SeatingChart class serves, and why it is a child class of Reservation when it inherits no methods and no states from the parent class.Your child class (SeatingChart) contains an instance of the parent class (Reservation) object called displaySeat. In SeatingChart's (the child object's) initialization code you instantiate the displaySeat object, and then in the constructor you call its display method. I think that you assume that the displaySeat object, since it is an instance of the parent Reservation class will automatically have all of the information from the reserveSeat object (another Reservation class object contained in the main method of the Airline class), but this assumption is wrong. Each object is unique and contains its own independent non-static information. I am no expert on OOP design, so I can only tell you so much, but I believe that your overall object model is broken and that
you should rethink the object model design from square one.
Possible ideas include:
Have a Seat class that contains a boolean "occupied" variable, a "seatNumber" String var, a "passengerName" String var and a "seatingLevel" variable (i.e., first or second class). An class called seatingLevel that holds arrays of seats and methods to access them, change them, and display them, can display number of seats available,...An airplane class that holds two instances of seatingLevel, one for first class and one for coach. There are many possible iterations that you could use. You might even want to put this project on hold for a bit and restudy a chapter or two on object oriented design before redesigning this. Learn how the pros do it first. I recommend
Just Java or
Head First Java as good beginners texts, but there are many others that are worthwhile too.
Good luck!
Pete
ps: have you thought about joining the Cattle Drive here? I have recently done just that and am learning quite a bit.
[ April 04, 2007: Message edited by: pete stein ]