A Tourist Attraction Calculation System Silver Express Theme Park (SETP) Pvt Ltd is a tourist attraction that offers three types of tickets:
- Regular adult tickets at R30 per person.
- Student tickets at R25 per person.
- Family ticket for two adults and two children is R75, with an additional R15 for each child beyond two children.
They have approached you as a C++ developer to develop a C++ application that would help to calculate the total price of tickets.
- The program should display a menu with three options. (3 Marks)
- The program should ask the user to select the type of tickets needed. If the first or second option are selected, the program should ask the user to enter the number of people in the group. However, if the third option is selected, the program should ask the user to enter the number of additional children in the group. (13 Marks)
- The program should then calculate the total amount due and display it on the screen. (8 Marks)
d. Make sure that the user cannot select invalid options in the menu and that the number of people in the group is always greater than 0.
Code:
#include <iostream> using namespace std; int main(void) { int choice; cout<<"\n Silver Express Theme Park Pvt. Ltd."; cout<<"\n==========================="; cout<<"\n 1.Regular Adult"; cout<<"\n 2. Student"; cout<<"\n 3.Family Ticket"; cout<<"\n Enter the type of ticket which you want: "; cin>>choice; //input taking if(choice==1){ //adult tickets total amount calculation int count; cout<<"Enter no.of persons:"; cin>> count; if(count>0) cout<<"Total amount due is :"<< count*30; else cout<<"no.of persons must be greater than zero"; } else if(choice==2){ //student tickets total amount calculation int count; cout<<"Enter no.of persons:"; cin>> count; if(count>0) cout<<"Total amount due is :"<< count*25; else cout<<"no.of persons must be greater than zero"; } else if(choice==3){ //family tickets total amount calculation int count; cout<<"Number of additional children in the group(more than 2):"; cin>> count; if(count>0) cout<<"Total amount due is :"<< (count*15)+75; else cout<<"no.of persons must be greater than zero"; } else{ //invalid option cout<<"Invalid Option"; } }