Flight Cost Calculator
A travel agency needs a program to calculate the total flight cost for a group of travelers.
The program should:
- Prompt for the number of travelers.
- Ask if they want extra baggage (£30 per traveler).
- Calculate the total cost using:
- Base ticket price: £200 per traveler
- Additional baggage cost: £30 per traveler (if selected).
- Apply a group discount:
- 10% discount for 5 or more travelers.
# Constants BASE_PRICE = 200
# Cost per ticket BAGGAGE_PRICE = 30
# Extra baggage cost DISCOUNT_THRESHOLD = 5
# Number of travelers needed for discount DISCOUNT_RATE = 0.10 # 10% discount
# Prompt for number of travelers
num_travelers = int(input("Enter the number of travelers: "))
# =====> Ask if extra baggage is needed (yes/no) and process input
# =====> Calculate total cost before discount
# =====> Apply discount if the number of travelers meets the threshold
# =====> Display the final total cost
Example Outputs:
Enter the number of travelers: 3
Do you need extra baggage? (yes/no): yes
Total cost: £690.00
Enter the number of travelers: 5
Do you need extra baggage? (yes/no): no
Total cost: £900.00