-
Notifications
You must be signed in to change notification settings - Fork 0
/
clirestaurant.py
109 lines (103 loc) · 4.13 KB
/
clirestaurant.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
def display_menu(menu):
print("Menu:")
for item, price in menu.items():
print(f"{item}: ${price:.2f}")
def display_order(order, total):
print("\nYour Order:")
for item, qty in order.items():
print(f"{item} x{qty}")
print(f"Total: ${total:.2f}")
def main():
menu = {
"Burger": 5.99,
"Pizza": 8.99,
"Fries": 2.49,
"Coke": 1.99,
"Salad": 4.49
}
order = {}
total = 0.0
delivery_fee = 3.00
print("Welcome to Fast Food Ordering System!")
while True:
print("\nPlease select an option:")
print("1. View Menu")
print("2. Add Item to Order")
print("3. Remove Item from Order")
print("4. View Current Order")
print("5. Proceed to Checkout")
print("6. Exit")
choice = input("Enter your choice (1-6): ")
if choice == '1':
display_menu(menu)
elif choice == '2':
display_menu(menu)
item = input("Enter the item you want to add: ").strip().title()
if item in menu:
qty = input("Enter the quantity: ")
if qty.isdigit() and int(qty) > 0:
qty = int(qty)
if item in order:
order[item] += qty
else:
order[item] = qty
total += menu[item] * qty
print(f"{qty} {item}(s) added to your order.")
else:
print("Please enter a valid quantity.")
else:
print("Item not found in the menu.")
elif choice == '3':
display_order(order, total)
item = input("Enter the item you want to remove: ").strip().title()
if item in order:
qty = input("Enter the quantity to remove: ")
if qty.isdigit() and int(qty) > 0:
qty = int(qty)
if qty >= order[item]:
total -= menu[item] * order[item]
del order[item]
print(f"All {item}(s) removed from your order.")
else:
if order[item] - qty > 0:
order[item] -= qty
total -= menu[item] * qty
print(f"{qty} {item}(s) removed from your order.")
else:
total -= menu[item] * order[item]
del order[item]
print(f"All {item}(s) removed from your order.")
else:
print("Please enter a valid quantity.")
else:
print("Item not found in your order.")
elif choice == '4':
display_order(order, total)
elif choice == '5':
if not order:
print("Your order is empty. Please add items before proceeding to checkout.")
continue
print("\nProceeding to Checkout")
address = input("Please enter your delivery address: ")
total_with_fee = total + delivery_fee
print("\nOrder Summary:")
display_order(order, total)
print(f"Delivery Fee: ${delivery_fee:.2f}")
print(f"Total with Delivery: ${total_with_fee:.2f}")
print(f"Delivery Address: {address}")
confirm = input("Confirm order? (yes/no): ").strip().lower()
if confirm == 'yes':
print("Thank you for your order! Your food will be delivered soon.")
print(f"Order Total: ${total_with_fee:.2f}")
# Reset order for a new customer
order = {}
total = 0.0
else:
print("Order canceled.")
elif choice == '6':
print("Thank you for visiting our Fast Food Ordering System. Goodbye!")
break
else:
print("Invalid choice. Please select a valid option.")
if __name__ == "__main__":
main()