A small airline has just purchased a computer for its new automated reservations
system. You've been asked to develop the new system. You're to write an application
to assign seats on each
ight of the airline's only plane. The number of available
seats n is given by user.
Your application should display the following alternatives: please type 1 for First
Class and or 2 for Economy
If the user types 1, your program should assign a seat
in the rst class section (seats 1->n/2)If the person types 2, your program
should assign a seat in the economy section (seats n/2+1->n). Your program
should then print a boarding pass indicating the person's seat number and whether
it is in the rst 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 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 program should never assign a seat that has already been assigned. When
the economy section is full, your program should ask the person if it is acceptable
to be placed in the rst class section (and vice versa). If yes, make the appropriate
seat assignment. If no, print the message \Next
ight leaves in 3 hours."
If there is no more available seats, your application should quit by printing the
following message \Booking closed".