Project
Project
import random
def main_menu():
print("Welcome to Digital School Canteen Management System")
print("Please choose from the following options:")
print("1. Show menu")
print("2. Place order")
print("3. Checkout")
print("4. Quit")
def show_menu():
menu = {
"Veg Sandwich": 25,
"Chicken Sandwich": 35,
"French Fries": 20,
"Soft Drink": 15,
"Milkshake": 60,
}
print("\nMenu:")
for item, price in menu.items():
print(f"{item}: ${price}")
def place_order():
print("\nPlease enter the items you want to order separated by commas:")
items = input().split(',')
menu = {
"Veg Sandwich": 25,
"Chicken Sandwich": 35,
"French Fries": 20,
"Soft Drink": 15,
"Milkshake": 60,
}
order = {}
total = 0
for item in items:
if item.strip() in menu:
order[item.strip()] = menu[item.strip()]
total += menu[item.strip()]
else:
print(f"Error: {item} is not a valid item. Please enter valid items.")
return
print("\nOrder summary:")
for item, price in order.items():
print(f"{item}: ${price}")
print(f"Total: ${total}")
method = input()
if method == "1":
print("\nPayment successful. Please collect your items and enjoy your
meal!")
elif method == "2":
print("\nPayment successful. Please collect your items and enjoy your
meal!")
else:
print("\nInvalid payment method. Please choose either Cash or Card.")
def run_program():
while True:
main_menu()
choice = input()
if choice == "1":
show_menu()
elif choice == "2":
order, total = place_order()
if order and total:
checkout(order, total)
elif choice == "3":
print("\nCheckout not implemented yet. Please use the \"Place order\"
option instead.")
elif choice == "4":
print("\nThank you for using Digital School Canteen Management
System!")
break
else:
print("\nInvalid choice. Please choose a valid option.")
run_program()