Loading...
Loading...
Loading...
A cinema prices tickets by age:
Shows that start before 12 noon are morning shows, and every paid ticket for a morning show is ₹40 cheaper. Free tickets stay free. Read the viewer's age and the show's starting hour (24-hour time) and print the price.
Price: X.Example 1
Input
25 18
Output
Price: 200
An adult at an evening show pays the full ₹200.
Example 2
Input
8 10
Output
Price: 80
A child at a morning show: 120 − 40 = 80.
Try the problem first. Open one hint at a time.
First find the full price with an else-if ladder on the age.
Then apply the morning discount, but only when the price is above zero: a condition with &&.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor