Question: / / Program TicketPrice prints the price for a ticket to / / the Wonderland park based on an age input from the keyboard #include

// Program TicketPrice prints the price for a ticket to
// the Wonderland park based on an age input from the keyboard
#include
using namespace std;
int main()
{
int age;
cout << "Welcome to Wonderland Park! Please enter your age:"
<< endl;
cin >> age;
if ( age <=3)
cout << "Children under 3 can enjoy free admission. "<< endl;
/* TO BE FILLED IN FOR EXERCISE 6*/
else
cout << "Your ticket price is $50."<< endl;
return 0;
}
Exercise 6.
Add two else-if statements so that children 4 to 12 years old (including 4 and 12) only need to pay $20
for ticket and senior citizens 65 or above only need to pay $30 for ticket. Run your program using the
following values as input: 2,4,12,37,65,71. Show the statements you added and the results for the input
values in the report.
Note: Remove any redundant condition in the logical expressions you wrote for this exercise, otherwise
you may only earn partial credit even if the results are correct.
Exercise 7.
Replace the following statement in Exercise 6
cout << "Your ticket price is $50."<< endl;
with compound statements to check if the guest is eligible for other discounts. Display the following
message:
Are you a student or veteran?
Please enter Y for Yes and N for No.
If the answer is Y, then display the following message:
"You may be eligible for discounted price.
Please show your ID to our staff."
Otherwise (the answer is N), display the original message of price $50. Show your compound
statements and the results of a few testing cases.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!