In: Computer Science
Program this scenario in C.
Scenario:
I am in highschool and i want to go see a movie. I have a certain amount of money to spend. Matinees are $8.50 and Evening Showings are $11.75. There is a G, PG, PG-13, and R movie at the theater. Ask the highschooler their age and how much money they have. With this info determine what showtime they can go see and what movies they are not allowed to see. Make it fun by assigning movie titles instead of ratings.
#include <stdio.h>
int main(void) {
int age;
float money;
printf("Enter your age : ");
scanf("%d",&age);
printf("\nHow much money do you have ? : ");
scanf("%f",&money);
if(age >=14 && age <=18)
printf("\nYou can watch G, PG, PG-13 movies");
if(money >= 11.75)
printf("\nYou can watch evening show");
else if(money >= 8.50 && money
<11.75)
printf("\nYou can watch Matinee show");
else
printf("You have insufficient money");
return 0;
}
Output:
Enter your age : 15 How much money do you have ? : 9.0 You can watch G, PG, PG-13 movies You can watch Matinee show
Do ask if any doubt. Please upvote.