Final answer:
To write a program that calculates movie ticket prices based on age and time, you can use if-else statements to apply the given conditions. The code example provided is in Python and demonstrates how to calculate the ticket price based on the 'day' or 'night' input and the person's age.
Step-by-step explanation:
To write a program that takes in a string representing 'day' or 'night' and an integer representing a person's age, you can use if-else statements to determine the movie ticket price based on the given conditions. Here's an example in Python:
def calculate_ticket_price(time, age):
if time == 'day' and age >= 4:
return 8
elif time == 'night':
if age >= 4 and age <= 16:
return 12
elif age >= 17 and age <= 54:
return 15
elif age >= 55:
return 13
else:
return 0
# Example usage:
time = 'day'
age = 10
price = calculate_ticket_price(time, age)
print('The ticket price is $' + str(price))