Amjad reached Emporium with his family. They are all excited since he successfully passed his test for BSCS admission and now, they are here to celebrate. All the family members are interested in watching the movie while having popcorn. You must ask Amjad the number of people with him. Emporium Cinema is offering different type of tickets for the film: [Student (S) 250, Normal (N) 400, and Executive (E) 750]. Any choice other than mentioned is considered as invalid input. Ask them what ticket choice will they prefer. Before the start of the film, all the family members decide to have popcorn also. Popcorn stall is offering three different flavors. [Simple (S) 100, Tacos (T) 150, and Caramel (C) 200]. Any choice other than mentioned is considered as invalid input. Ask them what popcorn choice will they prefer.
Calculate and print the amount used for the film and popcorn separately and the total expense at the end. Your solution should show proper menu-based system.
#include <iostream>
using namespace std;
int main()
{
int checkTickets = 0, checkPopcorn = 0;
cout<<"Ticket cost:"<<endl;
cout<<"[S] Student: 250"<<endl;
cout<<"[N] Normal: 400"<<endl;
cout<<"[E] Executive: 750"<<endl;
char temp =' ';
cout<<"Buy tickets. Type q to stop"<<endl;
while(temp!='Q'&&temp!='q'){
cin>>temp;
switch(temp){
case 's': case 'S': checkTickets+=250; break;
case 'n': case 'N': checkTickets+=400; break;
case 'e': case 'E': checkTickets+=750; break;
}
}
cout<<"Popcorn menu"<<endl;
cout<<"[S] Simple: 100"<<endl;
cout<<"[T] Tacos: 150"<<endl;
cout<<"[C] Caramel: 200"<<endl;
temp=' ';
while(temp!='Q'&&temp!='q'){
cin>>temp;
switch(temp){
case 's': case 'S': checkPopcorn+=100; break;
case 't': case 'T': checkPopcorn+=150; break;
case 'c': case 'C': checkPopcorn+=200; break;
}
}
cout<<"Price of tickets: "<<checkTickets<<endl;
cout<<"Price of popcorn: "<<checkPopcorn<<endl;
cout<<"Total expense: "<<checkTickets+checkPopcorn<<endl;
return 0;
}
Comments
Leave a comment