Urdaneta, Dan Lloyd B.
BSCS 601
Programming Language
Performance Task
You are tasked with creating a Python program to help plan a birthday celebration. The program will
prompt users to input estimated costs for five (5) different expense categories: venue, catering,
decorations, entertainment, and miscellaneous items. The program will then calculate the total
estimated cost and determine if it falls within a predefined budget.
CODE:
# Birthday Celebration Budget Calculator
# Function to get valid numerical input
def get_cost(category):
while True:
try:
cost = float(input("Enter the estimated cost for {}:
$".format(category)))
if cost < 0:
print("Please enter a positive number.")
continue
return cost
except ValueError:
print("Invalid input. Please enter a numerical value.")
# Input estimated costs
venue_cost = get_cost("Venue")
catering_cost = get_cost("Catering")
decorations_cost = get_cost("Decorations")
entertainment_cost = get_cost("Entertainment")
misc_cost = get_cost("Miscellaneous")
# Calculate total estimated cost
total_cost = 0
total_cost += venue_cost
total_cost += catering_cost
total_cost += decorations_cost
total_cost += entertainment_cost
total_cost += misc_cost
# Define a predefined budget
budget = 1000.00 # You can change this value
# Output the total and budget comparison
print("\n--- Birthday Budget Summary ---")
print("Total Estimated Cost: ${:.2f}".format(total_cost))
print("Budget: ${:.2f}".format(budget))
if total_cost <= budget:
print("Status: The total estimated cost is within the budget.")
else:
print("Status: The total estimated cost exceeds the budget.")