Question

In this assignment, you will develop a Python program that will process applications for gala-type events...

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:

  • Due to the physical size of the building, its maximum occupancy for any event is 100—not including the club staff.
  • Since local regulations do not permit the sale of alcoholic beverages after midnight, the maximum length of any event is 6 hours (360 minutes).

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:

  1. Supply good program comments so another programmer can read and understand your program.
  2. Prompt the customer for the name of the event.
  3. Prompt the customer for their full name.
  4. Prompt the customer to enter the number of guests attending. Validate this number against the club's maximum capacity.
  5. Prompt the customer for the length of the event (in minutes). Validate the event length against the maximum length allowed. The minutes will also be used to determine the number of hours the servers must be available.
  6. There will be one server assigned to every 20 guests. Calculate the number of servers needed. Then, if necessary, round up the number of servers to the next whole server. Hint: Use modulus operator.
  7. Servers will be paid $18.50 per hour and for any portion of an hour. For example, 270 minutes is 4 hours and 30 minutes. Calculate the number of hours and minutes. Hint: Use modulus operator.
  8. The event will be catered and the guests will have a choice of three dinners. The customer will be asked to enter the number of chicken dinners ($24.50 each), the number of salmon dinners ($32.50 each) and the number of vegetarian dinners ($19.50 each).
  9. Calculate and output the total cost for the event along with the average cost per person. The caterer requires a 25% deposit on the event. All decimals must line up in the output. Output must be labeled and easy to read as shown in the samples below.
# 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: 

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT