Question
A small airline has just purchased a computer for its new automated reservations system. The CTO has asked you to program the new system. Youll
A small airline has just purchased a computer for its new automated reservations system. The CTO has asked you to program the new system. Youll write a program to assign seats on each flight of the airlines only plane (capacity: 72 seats, in 12 rows). For the sake of simplicity, assume that each row has 6 seats labeled A, B, C, D, E, F. Rows A and F and window seats. Your program should display the following menu of alternatives: Please type F for "first class" Please type B for "business class" Please type E for economy class If the person types F, then your program should assign a seat in the first class section (rows 1-2).
If the person types B, then your program should assign a seat in the business class section (rows 3-5).
If the person types E, then your program should assign a seat in the economy section (rows 612).
Seat Assignment is done using random numbers (i.e., Use a random number generator to select the seat and then check if that seat is un-assigned). Confirm with the user if he/she wants a Window seat or Aisle. If user doesnt want the selected seat, repeat the random seat assignment process again (dont repeat this more than 3 times for one user). After the seat is assigned, your program should give the following menu options to the user to print:
(1) the seating map/chart showing all 72 seats and indicating if each seat is filled,
(2) prints a passenger manifest showing names of all passengers and their seat numbers in a tabular format, and
(3) prints a boarding pass for a chosen seat number indicating the person's name, seat number and whether its in the first class or business class or economy section of the plane (For example: JOHN DOE, SEAT: 2B, Level: First Class).
User will provide the seat number for this option and if no passenger is assigned to the selected seat, you should print a message, Seat Unassigned - No Boarding pass available. Try Again! Use a double-subscripted (2D) array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding element of the array to 1 to indicate that the seat is no longer available. Your program should, of course, never assign a seat that has already been assigned. When the first class section is full, your program should ask the person if its acceptable to be placed in the business class. Similarly, if the business section is full, ask the user if economy section is acceptable. Similarly, user should have the choice of upgrading to business class or first class if a seat is available. If user chooses to change his/her choice, then make the appropriate seat assignment. If no seat is available in chosen section, then print the message "Next flight leaves in 3 hours." Note: Airlines typically use a seating map/chart similar to the one shown below. Design your own version of seating chart (you dont have to use graphics or colors)
Note: Write a modular program, a program which uses appropriate functions to complete the task. Dont write all the code in main function. To-do: Part1: Write an algorithm /pseudocode for the program Part2: Implement and fully test the program as described above. While testing, make sure that you have enough passengers added to the flight to check if you users can successfully upgrade and downgrade, as needed.
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started