In this assignment, you will develop a Python program that will process applications for gala-type events at a local dinner club. The club, Gala Events Inc., is currently booking events for the upcoming holidays. However, the club has the following restrictions:
Write a program that asks the user to enter the name of the event, the customer requesting to book the event, number of people attending the event, the requested length of the event, and the number of catered dinners needed. Validate that the number of people attending the event and the event's requested length are within the restrictions listed above. If either restriction is not met, display a descriptive error message citing the restriction and how it can be met. Display a message to the customer if the number of dinners ordered exceed the number of guests attending the event (See Requirement 8 below.). Do not calculate any event costs until all the above requirements are met.
Requirements:
# Sample Run 1 Gala Events Inc. Enter event name: Holiday Season Event Enter customer full name: Susie Eventmaker Enter number of guests: 125 Your number of guests exceeds our club capacity of 100 guests. Either decrease the number of guests below 100 or find another venue. Enter number of guests:
# Sample Run 2 Gala Events Inc. Enter event name: Alumni Dinner Enter customer full name: Sara Sinclair Enter number of guests: 26 Enter event duration (in minutes): 125 Enter number of chicken dinners: 10 Enter number of salmon dinners: 6 Enter number of veggie dinners: 10 Alumni Dinner Event estimate for Sara Sinclair Number of servers: 2 Food cost: 635.00 Server cost: 77.08 Average cost per person: 27.39 Total cost is: 712.08 Please provide a 25% deposit to reserve the event The deposit is: 178.02
# Sample Run 3 Gala Events Inc. Enter event name: Alumni Dinner Enter customer full name: Sara Sinclair Enter number of guests: 15 Enter event duration (in minutes): 59 Enter number of chicken dinners: 1 Enter number of salmon dinners: 1 Enter number of veggie dinners: 13 Alumni Dinner Event estimate for Sara Sinclair Number of servers: 1 Food cost: 310.50 Server cost: 18.19 Average cost per person: 21.91 Total cost is: 328.69 Please provide a 25% deposit to reserve the event The deposit is: 82.17
# Sample Run 4 Gala Events Inc. Enter event name: Alumni Dinner Enter customer full name: Sara Sinclair Enter number of guests: 50 Enter event duration (in minutes): 61 Enter number of chicken dinners: -1 Enter number of chicken dinners:
Here is the solution,
please note:- the total cost of servers which i have calculating is exactly as per the requirement. In one of your output
the cost for servers was not matching. But i have coded exactly as per the requirement.
All the required validation is also working perfectly.
#your code starts here
import math
def main():
print("----------------------------")
print(" GALA EVENT INC ")
print("----------------------------")
event_name = input("Enter event name: ")
customer_name = input("Enter customer full name: ")
no_of_guests = check_no_of_guests()
no_of_minutes = check_no_of_minutes()
dinners = accept_dinners(no_of_guests)
no_of_servers = cal_no_of_servers(no_of_guests)
hours_minutes = cal_hours_minutes(no_of_minutes)
#calculating cost of chicken dinner
cost_of_chicken_dinners = dinners[0] * 24.50
#calculating cost of salmon dinner
cost_of_salmon_dinners = dinners[1] * 32.50
#calculating cost of veggie dinner
cost_of_veggie_dinners = dinners[2] * 19.50
#calculating cost of servers
cost_of_servers = no_of_servers * (18.50 * hours_minutes[0])
if hours_minutes[1] > 0:
cost_of_servers = cost_of_servers + (18.50 * no_of_servers)
#calculating total cost of food
food_cost = cost_of_chicken_dinners + cost_of_salmon_dinners +
cost_of_veggie_dinners
#calculating total cost
total_cost = food_cost + cost_of_servers
#calculating average
average_cost_per_person = total_cost/no_of_guests
#calculating deposit
deposit = total_cost * 0.25
print("----------------------------")
print(" GALA EVENT INC ")
print("----------------------------")
print("Event Estimate for :",customer_name)
print()
print("Time :
",hours_minutes[0],"Hours",hours_minutes[1],"Minutes")
print("No. of Servers :",no_of_servers)
print("Total Food Cost :",food_cost)
print("Total Server Cost :", cost_of_servers)
print("Average Cost per Person:",
"{:.2f}".format(average_cost_per_person))
print("Total Cost :",total_cost)
print("Please provide a 25% deposit to reserve the event")
print("The deposit is: ",deposit)
#function for converting minutes into hours and minutes
def cal_hours_minutes(no_of_minutes):
#calculating hours
hours = no_of_minutes//60
#calculating minutes
minutes = no_of_minutes - (hours * 60)
return (hours,minutes)
# functio for calculating no. of servers
def cal_no_of_servers(no_of_guests):
# use of ceil function for convertinf the fraction to next integer
number
return math.ceil(no_of_guests/20)
# functio to check no of guests if it is <=100
def check_no_of_guests():
while(True):
no_of_guests = int(input("Enter number of guests: "))
if no_of_guests > 100:
print("Your number of guests exceeds our club capacity of 100
guests.")
print("Either decrease the number of guests below 100 or find
another venue.")
continue
else:
return no_of_guests
# functio to check no of minutes if it is <=360
def check_no_of_minutes():
while(True):
no_of_minutes = int(input("Enter event duration (in minutes):
"))
if no_of_minutes > 360:
print("Your number of minutes exceeds our club time limit.")
print("Either decrease the minutes (below 360) or find another
venue.")
continue
else:
return no_of_minutes
#function for accepting dinners
def accept_dinners(no_of_guests):
while(True):
chicken_dinner = int(input("Enter number of chicken dinners:
"))
salmon_dinner = int(input("Enter number of salmon dinners:
"))
veggie_dinner = int(input("Enter number of veggie dinners:
"))
if no_of_guests == (chicken_dinner + salmon_dinner +
veggie_dinner):
# returning data in form of a tuple
return (chicken_dinner,salmon_dinner,veggie_dinner)
else:
print("The no of dinner is more than the no of guests.....")
print("Please enter the data again...")
continue
main()
#code ends here
here is the sample output:-
Thank You
Get Answers For Free
Most questions answered within 1 hours.