Cinema
Lesson 8 of 25 in Coddy's Coding Problems: Volume 2 course.
Create a system for a cinema to return the price of the ticket for a movie. The initial price for the movie is 200, if the movie is a comedy it's an additional 30, if it's an action movie is an additional 40, and if it's a horror it is an additional 20. Next, if you get a small popcorn (S) it's an additional 100, a medium (M) an additional 150, and a large (L) an additional 200 and finally, if you pay with a card you get a 10% discount
Challenge
EasyWrite the program to calculate the total price for 3 tickets, in the first row the type of movie will be specified (string), in the following the size of popcorn will be specified (char), in the next row the number of people getting a ticket and popcorn will be given, followed by a 1 if it's paid with a card, or a 0 otherwise. Output the total price
Input
comedy
S
4
1
Output
1188
Explanation
4 people are buying 230 worth of tickets, and 100 worth of popcorn, 330 * 4 = 1320, and a 10% discount for paying with a card is a total of 1188
Try it yourself
#include <stdio.h>
int main() {
// Write code here
return 0;
}
All lessons in Coding Problems: Volume 2
1Course Introduction
Introduction2Easy Difficulty
GPAEven / Odd SumAverage ValueTaxingVideo GamePhone CompanyCinemaDateString Conversion