`enter code here`main ()
enter code here
{ enter code here
int adultTickets = 0, seniorTickets = 0, childTickets = 0, enter code here
infantTickets = 0, baggage = 0, age = 0, passengerTotal = 0; enter code here
double totalBaggagefee = 0.0, baggageFee1 = 20.00, baggageFee2 enter code here
= 35.00, adultFee = 147.30, seniorFee = 137.75, childFee = enter code here
110.25, infantFee = 0.0, totalTicket = 0.0, enter code here
totalwithCheckedbaggage = 0.0; enter code here
char reply; enter code here
string input; enter code here
cin >> input; enter code here
string Yes = "YES"; enter code here
string No = "NO"; enter code here
string quit = "QUIT";
enter code here
cout << "Enter your age. "; enter code here
cin >> age; enter code here
if (age > 18); enter code here
{ enter code here
cout << "You are old enough to buy a ticket." << endl; enter code here
cout << "Would you like to purchase a ticket now? "; enter code here
cin >> reply;
`enter code here`if (input == Yes);
`enter code here`{
`enter code here`cout << "How many Adult Tickets? ";
`enter code here`cin >> adultTickets;
`enter code here`cout << "How many Senior Tickets? ";
`enter code here`cin >> seniorTickets;
`enter code here`cout << "How many Child Tickets? ";
`enter code here`cin >> childTickets;
`enter code here`cout << "How many Infant Tickets? ";
`enter code here` cin >> infantTickets;
`enter code here` cout << "Number of checked baggage? ";
`enter code here`cin >> baggage;
`enter code here`cout << endl;
`enter code here`if (baggage <= passengerTotal);
`enter code here` totalBaggagefee =
enter code here
passengerTotalbaggageFee1; enter code here
totalTicket = (adultTicketsadultFee)+enter code here
(seniorTicketsseniorFee)+(childTicketschildFee)+(infantTickets*infantFee); enter code here
totalwithCheckedbaggage = totalTicket+totalBaggagefee; enter code here
{
enter code here
cout << "Your total including check baggage is " << totalwithCheckedbaggage << "" << endl; enter code here
}
enter code here
else (baggage >= passengerTotal); enter code here
totalBaggagefee = passengerTotal * baggageFee1 + 1 * baggageFee2; enter code here
totalTicket = (adultTicketsadultFee)+(seniorTicketsseniorFee)+(childTicketschildFee)+(infantTicketsinfantFee); enter code here
totalwithCheckedbaggage = totalTicket+totalBaggagefee; enter code here
{
enter code here
cout << "Your total including check baggage is " << totalwithCheckedbaggage << "" << endl; enter code here
} enter code here
else (input == No); enter code here
{ enter code here
cout << "You are a minor, have an adult purchase your ticket. "; enter code here
cout << "Thank you." << endl; enter code here
}
enter code here
cout << "Type quit to end. "; enter code here
cin >> reply; enter code here
cout << endl; enter code here
exit(1); enter code here
}
enter code here
else if (age<18); enter code here
{ enter code here
cout << "You are too young, have an adult buy your ticket. " << endl; enter code here
}
`enter code here`return 0;
`enter code here`}}
Aucun commentaire:
Enregistrer un commentaire