1. (12 pts) You run a movie theater that uses the following pricing scheme for t
ID: 3852018 • Letter: 1
Question
1. (12 pts) You run a movie theater that uses the following pricing scheme for tickets:
Matinee (before 5:00 pm)
Evening
(5:00 pm or after, including midnight showings)
Regular
$8.00
$10.50
Child (10 or younger)
Free
$4.00
Senior (65 or older)
$6.50
$8.00
Write a program that starts by allowing the user to enter the time of their desired showing. The time should be entered in 24-hour format as a single integer; for example, 1615 would be 4:15 pm, 1130 would be 11:30 am, and 0 would be midnight. Midnight is the latest showing offered by the theater.
The program should then prompt the user to enter the ages of all members in his/her party. Once the user has finished entering the ages, the program should report the number of regular, child, and senior tickets sold, along with the subtotals for each of those categories. Finally, the program should show the grand total at the end. Movie theaters generally include sales tax in their ticket prices, so don’t worry about adding tax separately.
Here’s a sample of what your program might look like when you run it. As usual, the underlined portions indicate what you type into the program as it’s running.
What time is your showing? 1930 Please enter the age of party member 1:
(any negative value to exit) 21 Please enter the age of party member 2:
(any negative value to exit) 19 Please enter the age of party member 3:
(any negative value to exit) 70 Please enter the age of party member 4:
(any negative value to exit) 3 Please enter the age of party member 5: (any negative value to exit) -1
Order summary:
(Evening rates)
Regular: $ 10.50 x 2 = $ 21.00
Child: $ 4.00 x 1 = $ 4.00
Senior: $ 8.00 x 1 = $ 8.00
TOTAL: $ 33.00
Matinee (before 5:00 pm)
Evening
(5:00 pm or after, including midnight showings)
Regular
$8.00
$10.50
Child (10 or younger)
Free
$4.00
Senior (65 or older)
$6.50
$8.00
Explanation / Answer
#include<iostream.h>
#include<conio.h>
void main(){
int sh_time,age,child=0,reg=0,sen=0;
cout<<" Enter the show timing: ";
cin>>sh_time;
for(int i=0;i<100;i++){
cout<<" Enter the age of the party member "<<i<<" (any negative value to exit) : ";
cin>>age;
if(age<0)
break;
else if(age<= 10)
child++;
else if(age >=65)
sen++;
else
reg++;
}
if(sh_time < 1300 ){
cout<< " (Morning rates) regular $8.00 X "<<reg<<" = "<<reg*8;
cout<<" Senior $6.50 X "<<sen<<" = "<<sen*6.50;
}
else{
cout<< " (Evening rates) regular $10.50 X "<<reg<<" = "<<reg*10.50;
cout<<" Child $4.00 X "<<child<<" = "<<child*4.50;
cout<<" Senior $8.00 X "<<sen<<" = "<<sen*8;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.