You have been asked by an airline to develop a reservation system program for sp
ID: 3551909 • Letter: Y
Question
You have been asked by an airline to develop a reservation system program for specific flights. A customer should be able to select from one of four categories of seats on flights from RDU to any of at least three other destinations. Based on the user input of seat type and destination, the number of seats of that type on that flight should be decreased and the appropriate fare should be displayed to the customer. Customers should not be able to select a sold out seat type on a particular flight and should be alerted if seats are sold out. Remaining seats available on a particular flight should be displayed appropriately.
So far this is what i'v put together i know it's not much,
Select one of four categories of seats, need to create 4 different seats.
Beginning destination is RDU chart at least three destinations, a step in purchasing is user choosing a seat type followed by a destination.
Create a database of all seats and flights and keep track of sold/unsold of all 4 categorys of seats.
Show cost of chosen seat/flight combo options
Email alerts when seats/flights are sold out.
Show all available seats and flights in real time.
Explanation / Answer
# Include <iostream>
using namespace std;
int showSeat (int sts [], int sn, int type) ;/ / verify whether the location is scheduled
void printCard (int sts [], int sn, int no) ;/ / print the intended results
int main ()
{
const int seatNo = 10 ;/ / class size, the number of seats
int seatState [seatNo] = {0} ;/ / seat on duty status
while (true)
{
cout << "******************* Welcome To TG AirPort *********************** * "<< endl << endl << endl ;/ / welcome message
cout << "Please type 1 for Smoking and type 2 for Nonsmoking:" ;/ / prompt customers two cabin choice
int type ;/ / cabin type number
cin >> type ;/ / enter the cabin type number
if (type! = 1 && type! = 2) / / determine customer input is a legitimate input
{
cout << "Please type the right number!" << endl ;/ / customer input illegal prompt return
continue;
}
else / / customers enter a valid continue
{
int sNo = showSeat (seatState, seatNo, type) ;/ / verify that the customer selected Class seat, and returns the customer to reserve a seat number
if (sNo! = 0) / / customers reserve a seat. = 0 means that the customer fails to reserve a seat
printCard (seatState, seatNo, sNo) ;/ / print customer reservations
}
}
return 0;
}
int showSeat (int sts [], int sn, int type) / / verify that the customer selected Class seat, and returns the customer to reserve a seat number
{
int sNo = 0 ;/ / holds the customer's selected seat number
if (type == 1) / / to determine the customers selected classes and
{
if (STS [0] == 1 && sts [1] == 1 && sts [2] == 1 && sts [3] == 1 && sts [4] == 1) / / to determine the space selected by the customer has all been scheduled, is, Print message
{
cout << "smoking passenger compartment is full!" << endl;
cout << "May beyou can book nonsmoking passenger compartment" << endl;
cout << "Next fight leaves in 3 hours." << endl;
}
else / / No, continue
{
cout << "The smoking passenger compartment's seat state are:" << endl;
for (int a = 0; a <= 4; a + +) / / display the space has been booked seat number
{
if (sts [a]! = 0)
cout << "Seat_No." << a +1 << "has been booked!" << endl;
}
for (int a = 0; a <= 4; a + +) / / display to change the space remaining seat number
{
if (STS [a] == 0)
cout << "Seat_No." << a +1 << "is available!" << endl;
}
cout << "Please type the available seat number to book:" ;/ / prompt the user to enter the number of reserved seat
cin >> SNO;
if (SnO <1 | | sno> 5) / / validate customer input is legitimate, whether to continue
{
cout << "Please type the right number to book:";
cin >> SNO;
}
}
}
else
{
if (STS [5] == 1 && sts [6] == 1 && sts [7] == 1 && sts [8] == 1 && sts [9] == 1) / / determine the space selected by the customer whether has all been scheduled, is, Print message
{
cout << "nonsmoking passenger compartment is full!" << endl;
cout << "May beyou can book smoking passenger compartment" << endl;
cout << "Next fight leaves in 3 hours." << endl;
}
else / / No, continue
{
cout << "The nonsmoking passenger compartment's seat state are:" << endl;
for (int a = 5; a <= 9; a + +) / / display the space has been booked seat number
{
if (sts [a]! = 0)
cout << "Seat_No." << a +1 << "has been booked!" << endl;
}
for (int a = 5; a <= 9; a + +) / / display to change the space remaining seat number
{
if (STS [a] == 0)
cout << "Seat_No." << a +1 << "is available!" << endl;
}
cout << "Please type the available seat number to book:" ;/ / prompt the user to enter the number of reserved seat
cin >> SNO;
if (SnO <6 | | sno> 10) / / validate customer input is legitimate, whether to continue
{
cout << "Please type the right number to book:";
cin >> SNO;
}
}
}
return sNo ;/ / return customers to reserve a seat number
}
void printCard (int sts [], int sn, int no) / / print customer reservations
{
if (no> sn | | sn <1) / / to determine whether the customers selected seats
{
cout << "There is no such seat with No." << no ;/ / No prompt
}
else / / continue
{
if (STS [no-]! = 0) / / determine whether the user selected seat number has been booked
cout << "Seat_No." << no << "has been booked!" << endl;
else
{
STS [no-1] = 1;
cout << "Booked successfully!" << endl;
cout << "******************* Compartment Info ******************" << endl << endl ;/ / print the intended results
if (no <= 5)
cout << "smoking passenger compartment seat_No:" << no << endl << endl;
else
cout << "nonsmoking passenger compartment seat_No:" << no << endl << endl;
cout << "********************************************** ********** "<< endl << endl;
}
}
}
class A:
def __ init__ (self, mlist = []):
self.mylist = mlist
class B:
def __ init__ (self):
self.P = None
the def setList (self):
self.P = A
a.mylist.append (self)
A1 = A ()
A2 = A ()
B1 = B ()
B2 = B ()
b1.setList (A1)
b2.setList (A1)
print a1.mylist
print a2.mylist
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.