Answer to Question #211315 in C++ for rahul

Question #211315

Silver Express Theme Park Pvt Ltd is a tourist attraction that offers three types of tickets.

1. Regular adult tickets at R30 per person.

2. Student tickets at R25 per person

3. Family ticket for two adults and two children is R75, with an additional R15 for each child beyond two children

Design a c++ application that will so the following:

a. The program should display a menu with three options.

b. The program should ask the user to select type of tickets needed. If the first or second options 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.

c. The program should then calculate the total amount due and display it on screen

d. Make sure the user cannot select invalid options in the menu and that the number of people in the group is always greater than 0


1
Expert's answer
2021-07-01T04:00:53-0400
#include<iostream>
using namespace std;
int main(){
cout<<"Pick the tickets by entering 1 or 2 or 3"<<endl;
cout<<"Do not enter 0"<<endl;
cout<<"Menu "<<endl;
cout<<"Option 1: Tickets for adults at R30 for every adult\n";
cout<<"Option 2: Tickets for students @ R25 for each student \n";
cout<<"Option 3: Tickets for family having 2 children and 2 adults is R75. R15 for each children exceeding 2 \n";
int adult;
adult = 30;
int student;
student = 25;
  int option;
  cin>>option;
  if(option==0){
  cout<<"0 is selected . O must not be entered";
  }
  else{
  
  if(option == 1){
  cout<<"Enter number of individual in the group. People's number must exceed 0"<<endl;
  int number_of_people;
  cin>>number_of_people;
  if(number_of_people == 0){
  cout<<"0 is selected . O must not be entered";
  }
  else{
  cout<<"The total amount due is\t"<<number_of_people * 30<<endl;
  }
  
  
  }
  else if(option==2){
  cout<<"Enter number of individual in the group. People's number must exceed 0"<<endl;
  int number_of_people;
  cin>>number_of_people;
  if(number_of_people == 0){
  cout<<"0 is selected . O must not be entered";
  }
  else{
  cout<<"The total price due is\t"<<number_of_people * 25<<endl;
  }
  
  }
  else if(option==3){
  cout<<"Enter number of individual in the group. People's number must exceed 0"<<endl;
  int number_of_people;
  cin>>number_of_people;
  if(number_of_people == 0){
  cout<<"0 is selected . O must not be entered";
  }
  else{
  cout<<"The total price due is\t"<<(number_of_people * 15) + 75<<endl;
  }
  
  }
  }
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS