Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

main.cpp #include #include // FIXME include vector library using namespace std; //Function should display menu options void DisplayMenu(); //Function should show all seats and seat

main.cpp

#include #include // FIXME include vector library

using namespace std;

//Function should display menu options void DisplayMenu(); //Function should show all seats and seat status. A 0 marks the seat status as available and an //1 marks the seat status as occupied void DisplayAllSeatsStatus(const vector &, const vector &); //Function display which seats are currently available void DisplayAvailableSeats(const vector &, const vector &); //Function should show the number of seats not currently booked int TotalNumberOfAvailableSeats(const vector &); //Function should take in a seat from user and mark that seat as unavailable void BookSeat(const string &, const vector &, vector &); //Function should take in a seat from user and mark that seat as available void CancelSeat (const string &, const vector &, vector &); //Function should take in two seats from the user. It should mark the first seat as available and //the second seat as unavailable void ChangeSeat(const string &, const string &, const vector &, vector &);

int main() {

/* Type your code here. */

return 0; }

Flight Reservation System

An airline uses a computer system to maintain flight sales information. For planning purposes, the airline must know what seats are on the plane, what seats are available, what seats are booked, and must have the ability to change the status of a seat from available to booked and vice versa. For this assignment, you will be implementing some of the functionality of the airline computer system. You will need to implement the following steps.

(1) Create the initial vectors for seats on the plane and seat status. You may assume that the plane has rows 1 through 5 and each row has seat A through D. The seat status is a 0 if the seat is available or a 1 if the seat is booked, and, therefore, not available.

(2) Implement a menu of options for the user. Following the initial setup of the vectors, the program outputs the menu. The program should also output the menu again after a user chooses an option. The program ends when the user chooses the option to Quit. Ex:

Menu options: 1. Display All Seats Status: 2. Total Number of Available Seats: 3. Display Available Seats: 4. Book Seat: 5. Cancel Seat: 6. Change Seat: 7. Quit: Please select an option: 

(3) Implement the "Display All Seats Status" menu option. Be sure to write a separate function for each menu option. Ex:

Seat Status 1A 0 1B 0 1C 0 1D 0 2A 0 ... 

(4) Implement the "Total Number of Available Seats" menu option. Ex:

Number of available seats: 20 

(5) Implement the "Display Available Seats" menu option. This function should show a list of available seats. Ex:

Available seats: 1A 1B 1C 1D 2A ... 

(6) Implement the "Book Seat" menu option. This function should take in the seat to book and then should change the status of that seat to unavailable. After the function, the status of all seats should be displayed. Ex:

Enter seat to book: 1A Seat Status 1A 1 1B 0 1C 0 1D 0 2A 0 ... 

(7) Add logic to the "Book Seat" menu option that will not allow the user to book a seat that is already booked. Ex:

Enter seat to book: 1A That seat is already taken. Enter seat to book: 1B Seat Status 1A 1 1B 1 1C 0 1D 0 2A 0 ... 

(8) Implement the "Cancel Seat" menu option. This function should take in the seat to cancel and then should change the status of that seat to available. After the function, the status of all seats should be displayed. Ex:

Enter seat to cancel: 1A Seat Status 1A 0 1B 0 1C 0 1D 0 2A 0 ... 

(9) Implement the "Change Seat" menu option. This function should take in the seat to cancel , the seat to book, and then should change the status of those seats. After the function, the status of all seats should be displayed. Ex:

Enter seat to cancel: 1A Enter seat to book: 1B Seat Status 1A 0 1B 1 1C 0 1D 0 2A 0 ...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions