Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that can be used to assign seats for a commercial airplane. The

ID: 3811825 • Letter: W

Question

Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class. Your program must prompt the user to enter the following information: a. Ticket type (first class, business class, or economy class) b. Desired seat Output the seating plan in the following form: Row 1 Row 2 Row 3 Row 4 Row 5 Row 6 Row 7 Row 8 Row 9 Row 10 Row 11 Row 12 Row 13 Here, indicates that the seat is available; X indicates that the seat is occupied. Make this a menu-driven program, show the user's choices and allow the user to make the appropriate choices.

Explanation / Answer

Hello,

The answer to the first question wherein seating plan for aiplane system has to be made is below .

Please find the C++ code below:-

===================================================================================

#include <iostream>

#include <string>

using namespace std;
int main()
{
char Seat = ' ';
string AirPlane[14] = {" ABCDEF","1X**XXX", "2XX**XX", "3X**XXX*", "4XXXX**", "5*XXX**", "6XX****", "7*XXXXX","8XXX**XX", "9X*****", "10XX***X", "11*XXXXX", "12XX**XX", "13X*****"};

char BookMore = ' ';
int RowNum = 0;
  
BookMore = 'y';
cout<<"Welome to ABC Airlines.Rows 1,2 are firt class,3-7 are buissness class and 8-13 are economy class"<<endl;
while(BookMore== 'y'or BookMore== 'Y')
{
cout << "Enter a class: ";
cin >> RowNum;
cout << "Enter a seat: ";
cin >> Seat;

int i = 1 + Seat - 'A';
if(AirPlane[RowNum-1][i]=='X')
{ //checks if seat is taken or not
cout << "Seat is taken." << endl;
continue;
  
}
else
AirPlane[RowNum - 1][i] = 'X';
cout << "Enter another seat? (y/n): ";
cin >> BookMore;

  
for(int j=0; j<14; ++j)
{
       cout << AirPlane[j] << endl;
}

} //end while

cout << "Thank You!" << endl;

system("PAUSE");
return 0;
}

===================================================================================

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote