0% found this document useful (0 votes)
27 views2 pages

Project

The document contains code for a digital school canteen management system that allows users to view the menu, place orders, and checkout. The main_menu function displays the menu options. The show_menu function displays the menu items and prices. The place_order function gets user input for ordered items, calculates the total, and returns the order and total. The checkout function handles payment and order completion. The run_program function runs the main loop that calls the other functions based on user input selection.

Uploaded by

partythird46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Project

The document contains code for a digital school canteen management system that allows users to view the menu, place orders, and checkout. The main_menu function displays the menu options. The show_menu function displays the menu items and prices. The place_order function gets user input for ordered items, calculates the total, and returns the order and total. The checkout function handles payment and order completion. The run_program function runs the main loop that calls the other functions based on user input selection.

Uploaded by

partythird46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import time

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}")

return order, total

def checkout(order, total):


print("\nPlease choose a payment method:")
print("1. Cash")
print("2. Card")

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()

You might also like