In: Computer Science
Create a C++ program based on the following criteria:
Program:
#include <iostream>
using namespace std;
int main() {
int selection;
double ticketPrice = 20;
cout<<"Menu for ticket prices:\n"<<endl;
cout<<"Enter 1 for Adult(15-64) \nEnter 2 forChild(0-14)\nEnter 3 for Senior(65+)\nEnter 4 for exit"<<endl;
cout<<"\n\nPlease enter a selection: ";
cin>>selection;
switch(selection)
{
case 1:
cout<<"Price of the ticket is "<<ticketPrice<<endl;
break;
case 2:
ticketPrice = (double)ticketPrice/2;
cout<<"Price of the ticket is "<<ticketPrice<<endl;
break;
case 3:
ticketPrice = (double)ticketPrice*0.8;
cout<<"Price of the ticket is "<<ticketPrice<<endl;
break;
case 4:
return 0;
}
}
Output: