Airline Reservations System
A small airline has just purchased a computer for its new automated reservation system.
You have been asked to develop the new system called ARSystem. You are to write an
application to assign seats on each flight of the airline's only plane (capacity: 24 seats.)
Your application should display the following alternatives: Please type 1 for FirstClass
and Please type 2 for Economy. If the user types 1, your application should assign a seat
in the first-class section (seats 1-8). If the user types 2, your application should assign
a seat in the economy section (seats 9-24). Your application should then display a boarding
pass indicating the person's seat number and whether it is in the first-class or economy
section of the plane.
Use a one-dimensional array of primitive type boolean to represent the seating chart of the
plane. Initialize all the elements of the array to false to indicate that all the seats are
empty. As each seat is assigned, set the corresponding elements of the array to true to
indicate that the seat is no longer available.
Your application should never assign a seat that has already been assigned. When the economy
section is full, your application should ask the person if it is acceptable to be placed in
the first-class section (and vice versa). If yes, make the appropriate seat assignment. If
no, display the message "Next flight leaves in 3 hours."
** Comment too , l2format **
(Create additional classes as necessary for it to work as intended)
You will recieve a Standard Grade for completion of this.
Extra credit will be given for a more creative approach to the problem, either minimum amount
of code, an additional display of seating beyond just the boarding pass, etc...
so far i did
CODE
public class Reservation{
int i=0;
int size = 24;
boolean[]seats=new boolean[24]
private void Reservation(){
emptyPlane();
fullPlane();
firstFull();
economyFull();
randomPlane();
}
private void emptyPlane (int i){
for (i=0; i<size; i++)
seats = false;
}
private void fullPlane (int i){
for (i=0; i<size; i++)
seats = true;
}
private void randomPlane (int i){
for (i=0; i<size; i++)
seats = false;
}
private void firstFull (int i){
for (i=0; i<size; i++)
seats = false;
}
private void economyFull(int i){
for (i=0; i<size; i++)
seats = true;
}
*edit: Please use code tags in the future, thanks!
This post has been edited by Martyr2: 14 Feb, 2008 - 09:53 PM