Question
C++ Project You have learned that programs can make simple choices and they never get tired of repeating things. You plan to write a simple
C++ Project
You have learned that programs can make simple choices and they never get tired of repeating things. You plan to write a simple program, Airfare.cpp, which repeatedly asks the user to enter ticket information and then calculates the total price for all the tickets entered.
The price of a ticket depends on the destination. The program has information on these destinations:
Destination | One-way Price |
Boston | $ 350.00 |
London | $ 600.00 |
Paris | $ 700.00 |
Tokyo | $ 800.00 |
If a ticket is requested to some other destination, the program informs the user that no tickets are available to that destination. The user can enter the city names as given or in all lower case.
The round trip price is the one-way price multiplied by 1.6. There is a 20% discount for students. The user enters this information by entering the letter Y or y to mean yes and N or n to mean no.
When the user enters the word Done or done when asked for the destination, the program outputs the total number of tickets and their total price and exits. A few sample runs are given below:
Sample Run 1
**************************************************************
Enter the information for each ticket.
When no more tickets to enter, enter 'Done' for destination.
**************************************************************
Enter the destination city: Boston
Round trip? [Y/N] N
Student discount? [Y/N] N
Enter the destination city: london
Round trip? [Y/N] N
Student discount? [Y/N] N
Enter the destination city: Done
--------------------------------------------------------------
2 tickets sold for a total sum of $950.00
--------------------------------------------------------------
Sample Run 2
**************************************************************
Enter the information for each ticket.
When no more tickets to enter, enter 'Done' for destination.
**************************************************************
Enter the destination city: London
Round trip? [Y/N] Y
Student discount? [Y/N] n
Enter the destination city: Paris
Round trip? [Y/N] N
Student discount? [Y/N] Y
Enter the destination city: london
Round trip? [Y/N] Y
Student discount? [Y/N] y
Enter the destination city: Berlin
No tickets are available to Berlin
Enter the destination city: done
--------------------------------------------------------------
3 tickets sold for a total sum of $2288.00
--------------------------------------------------------------
Sample Run 3
**************************************************************
Enter the information for each ticket.
When no more tickets to enter, enter 'Done' for destination.
**************************************************************
Enter the destination city: Lisbon
No tickets are available to Lisbon
Enter the destination city: madrid
No tickets are available to madrid
Enter the destination city: Barcelona
No tickets are available to Barcelona
Enter the destination city: Paris
Round trip? [Y/N] Y
Student discount? [Y/N] Y
Enter the destination city: done
--------------------------------------------------------------
1 tickets sold for a total sum of $896.00
--------------------------------------------------------------
Sample Run 4
**************************************************************
Enter the information for each ticket.
When no more tickets to enter, enter 'Done' for destination.
************************************************************** Enter the destination city: done
--------------------------------------------------------------
0 tickets sold for a total sum of $0.00
--------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started