Write C++ program to create the movie menu in fig. 1. The price of the tickect i
ID: 3751133 • Letter: W
Question
Write C++ program to create the movie menu in fig. 1. The price of the tickect is based on customer's age. 1. 17 and below: price is 30.50$ 2. 18-65: The price will be 20.99 3. 65 and above: The price will be 10$ Then display the price as shown in figure 2. Please enter letter associated with your age A 1? years and below B) 18 years to 65 years (C) 65 years and a bove CD> Exit Your Choice > Figure 1 Please enter letter associated with your age A 17 years and below B> 18 years to 65 years C> 65 years and a bove CD> Exit Your Choice > A The ticket will cost you: 18 Press any key to continue. . Figure 2 Note: 1. Use switch for branchExplanation / Answer
#include<iostream>
using namespace std;
int main()
{
// infinite loop
while(1)
{
cout<<"Please enter letter associated with your age: ";
cout<<"(A) 17 years and below ";
cout<<"(B) 18 years to 65 years ";
cout<<"(C) 65 years and above ";
cout<<"(D) Exit ";
char choice;
// get user input
cin>>choice;
switch(choice)
{
// 17 years and below
case 'A' : cout<<"The ticket wil cost you : 30.50$ ";
break;
// 18 years to 65 years
case 'B' : cout<<"The ticket wil cost you : 20.99$ ";
break;
// 65 years and above
case 'C' : cout<<"The ticket wil cost you : 10$ ";
break;
// exit the program
case 'D' : exit(0);
default : cout<<"Invalid Option! ";
break;
}
cout<<endl;
}
return 0;
}
Sample Output
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.