Question: Please use C++ code arrays You have been asked to develop a new automated reservation system for a small airline called Super Airline. You are
Please use C++ code arrays
You have been asked to develop a new automated reservation system for a small airline called Super Airline. You are to write an application to assign seats on each flight of the airlines only plane (capacity: 30 seats).
The application should display the following: Please type 1 for First Class or type 2 for Economy Class. Your application should then display the empty seats in the selected class and the corresponding airfare. The first-class section consists of seats 1 to 10 and the airfare of seat #1 is $2000 and every subsequent seat is $200 more. The Economy Class consists of seats 11 to 30 and the airfare of seat #11 is $1400 and every subsequent seat is $50 less. For example, if the user entered 2 and all the available Economy Class seats are displayed, such as:
Available Seats Fare
12 $1350
16 $1150
17 $1100
19 $1000
25 $700
The system should then ask the user to choose a seat to purchase. Then, your application should display a receipt indicating the persons seat number, whether its in the First-Class or Economy section of the plane, and the airfare paid.
Consider using parallel arrays: (1) a one-dimensional array of bool data type to represent the seating chart of the plane initialized to false to indicate empty seats and as each seat is assigned, set the corresponding element of the array to true to indicate that the seat is no longer available. (2) another array to store the airfares paid for corresponding seats of the plane.
Note: MUST use looping constructs to initialize the arrays, instead of hard-coding the values. Your application should never assign a seat that has already been taken. When the economy section is full, your application should display the lowest First-Class airfare available and ask the person if its acceptable to be placed in the first-class section (and vice versa). If yes, make the appropriate seat assignment. If no, display a message to inform the user no seats available in the desired class. The program should run continually until the user chooses to Quit. You should design the program carefully using functions wherever possible. For example, you may write separate functions to display the main menu, to initialize the arrays, to check for the next available empty seat in a specific class, to return the location of the lowest airfare in a specific class, to display the flight booking for a particular seat, etc. You should also pass parameters by reference wherever appropriate. For Display, your program should also offer options to display the status and airfare of all the seats, reserved seats only, empty seats only, and a specified seat.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
