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

Airline Scheduling Project In C Language (not C++) Write a reservation system fo

ID: 3688834 • Letter: A

Question

Airline Scheduling Project

In C Language (not C++)

Write a reservation system for an airplane flight. Assume the airline has 5 rows with 3 seats in each row (small plane!). Use a 2 dimensional array of type string to maintain a seating chart. In addition, create an array to be used as a waiting list in case the plane is full. The waiting list should be "first come, first served"; that is, people who are added early to the list get priority over those added later. Also, you must maintain a second 2 dimensional array (a parallel array) that reflects the cost of the seats. Pricing for the seat is described below. Keep a running tally of the money earned on each flight. Allow the user the following options:

 

1. Add a passenger to flight or waiting list

a. Request the passenger list

b. Display a chart of the seats in the airplane in tabular form, clearly titled, with the row and seat numbers clearly listed

c. If seats are available, let the passengers choose a seat. Inform the passenger of the seating cost. Add the passenger to the seating chart.

d. If no seats are available, place the passenger on the waiting list. Assume that the waiting list will grow to a maximum capacity of 10 passengers.

 

2. Remove a passenger from a flight

a. Search seating chart in the plane for a given name and delete this name from the seating chart. Ask for confirmation prior to deletion. There will not be any duplicate names.

b. If waiting list is empty, update the array so seat is available.

c. If waiting list is not empty, remove the first person from list, give him/her the newly vacated seat.

 

3. Allow the user an option to display the passenger list or the seating price list as desired.

 

4. Initialize the arrays that are used in the following manner:

(a) Initialize string arrays to “xxxxx”

(b) Initalize numeric arrays to 0.00

 

5. Seat pricing.

a. Seats in the first 2 rows are first class and cost $200.00

b. Seats in the last 3 rows are coach class and cost $100.00

c. Seats in the middle receive a 10% “discomfort” discount.

 

In C Language (not C++),   Create and implement functions as you think best. (Use them to the maximum extent.) Code your program so that the main( ) function is of small size and relies upon the functions created to achieve to functionality described above. [Remember, arrays are always passed by reference. If you need to change an array, do it within a function and the array, as seen from the main, will also be changed.]

 

In C Language (not C++) !
Please do the complete program
Thanks

Explanation / Answer

#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
#include<cstring>
usingnamespace std;
constint NUMROWS =14;
constint NUMSEATS =7;
//enum seatsType {A,B,C,D,E,F};
void initPlane(char plane[NUMROWS][NUMSEATS])
{
int x,y;
//strcpy(plane[2], "Row 1");
plane[0][0]=' ';
plane[0][1]='A';
plane[0][2]='B';
plane[0][3]='C';
plane[0][4]='D';
plane[0][5]='E';
plane[0][6]='F';
plane[1][0]='1';
plane[2][0]='2';
plane[3][0]='3';
plane[4][0]='4';
plane[5][0]='5';
plane[6][0]='6';
plane[7][0]='7';
plane[8][0]='8';
plane[9][0]='9';
plane[10][0]='W';
plane[11][0]='Y';
plane[12][0]='Z';
plane[13][0]='G';
for(x =1; x < NUMROWS ; x++)
{
for( y =1; y < NUMSEATS ; y++)
plane[x][y]='*';
}
}
// POSTCONDITION:
// plane[x][0] == 'A', 0<=x<13
// plane[x][1] == 'B', 0<=x<13
// plane[x][2] == 'C', 0<=x<13
// plane[x][3] == 'D', 0<=x<13
void printPlane(char msg[],char plane[NUMROWS][NUMSEATS])
{
cout << msg << endl;
intRow,col;
for(Row=0;Row< NUMROWS ;Row++)
{
for(col =0; col < NUMSEATS; col++)
cout <<setw(5)<< plane [Row][col]<<" ";
cout << endl;
}
}
// POSTCONDITION: The seating layout of the plane has been printed
// to the standard output with an X displayed for each taken seat.
int main()
{
int seatsTaken =0;
int seats = NUMROWS * NUMSEATS;
char plane[NUMROWS][NUMSEATS];
char keepGoing ='y';
int row =0;

char seat;
int rowIndex, seatIndex;
char ticketType[15];
initPlane(plane);
cout <<"Choose your seat!"<< endl;
while(seatsTaken < seats && keepGoing =='y')
{
//
// Show layout and get seat choice
//
printPlane("Plane layout; X designates taken seats", plane);
cout <<"Row 1 and 2 are first clss. "<< endl;
cout <<"Rows 3 through 7 are business class. "<< endl;
cout <<"Rows 8 through 13 are economy class. "<< endl;
cout <<"Eneter ticket type (first class,business class,or economy class) :";
cin >> row >> seat;
// Adjust input to use as indices
rowIndex = row;
if( seat =='A'|| seat =='a')
seatIndex =1;
elseif( seat =='B'|| seat =='b')
seatIndex =2;
elseif( seat =='C'|| seat =='c')
seatIndex =3;
elseif( seat =='D'|| seat =='d')
seatIndex =4;
elseif( seat =='E'|| seat =='e')
seatIndex =5;
elseif( seat =='F'|| seat =='f')
seatIndex =6;
//
// Check to see if seat is taken
//
if(plane[rowIndex][seatIndex]=='X')
cout <<"Sorry, "<< row << seat <<" is already taken."<< endl;
else
{
cout <<"OK, you've got "<< row << seat << endl;
plane[rowIndex][seatIndex]='X';
seatsTaken++;
}
//
// If there are seats left, check we should keep going
//
if(seatsTaken < seats)
{
cout <<"Choose another seat? (y/n) ";
cin >> keepGoing;
}
else
cout <<"Plane is now full!"<< endl;
}
printPlane("Final seating chart", plane);
return0;
}

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