-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoffee_Machine.py
94 lines (87 loc) · 2.79 KB
/
Coffee_Machine.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
import art
print(art.logo)
def payment(order):
print("Please Insert Coins")
Paycheck=float(input("Enter Quarters: ")) * 0.25
Paycheck+=float(input("How many Nickels: ")) * 0.10
Paycheck+=float(input("How many Dimes: ")) * 0.05
Paycheck+=float(input("How many Pennies: ")) * 0.1
if Paycheck == Menu[order]["cost"]:
print(f"\nYour order Cost: ${Menu[order]['cost']}")
print(f"Your Paid Amount: ${Paycheck}")
print("Enjoy your Coffee & Have A nice Day!!")
return Paycheck
elif Paycheck > Menu[order]["cost"]:
balance=Paycheck-Menu[order]["cost"]
print(f"\nYour order Cost: ${Menu[order]['cost']}")
print(f"Your Paid Amount: ${Paycheck}")
print(f"Your change: ${balance}")
print("Enjoy your Coffee &1"
" Have A nice Day!!")
return Paycheck-balance
else:
print("Insufficient Amount")
return
def Check_Availability(order):
if(report["Water"] >= Menu[order]["ingredients"]["water"]) and (
report["Coffee"] >= Menu[order]["ingredients"]["coffee"])\
and (report["Milk"] >= Menu[order]["ingredients"]["milk"]):
report["Water"] -= Menu[order]["ingredients"]["water"]
report["Coffee"] -= Menu[order]["ingredients"]["coffee"]
report["Milk"] -= Menu[order]["ingredients"]["milk"]
return 0
else:
return 1
Menu = {
"Espresso":{
"ingredients":{
"water":50,
"coffee":18,
"milk":0
},
"cost":1.50
},
"Latte":{
"ingredients": {
"water": 200,
"milk": 150,
"coffee": 24
},
"cost":2.50
},
"Cappuccino":{
"ingredients": {
"water": 250,
"milk": 100,
"coffee": 24
},
"cost":3.00
}
}
report = {
"Water": 300,
"Milk": 200,
"Coffee": 100,
"Money_earned":0
}
while True:
print("\nHey There!!, Welcome to 'Latte On The Rocks'\n")
user=int(input("Admin : '1'\nCustomer : '2'\nExit : '3\n"))
if user == 1:
print(f"Water:{report['Water']}ml\nMilk:{report['Milk']}ml\nCoffee:{report['Coffee']}g\nMoney earned:${report['Money_earned']}")
elif user == 2:
order=input("Here is the menu:\n"
"1. 'Espresso' : $1.50\n"
"2. 'Latte' : $2.50\n"
"3. 'Cappuccino' : $3.00\n")
available=Check_Availability(order)
if available == 0:
print(f"Your order {order} is Available Please pay the Bill and wait for the order")
Cash = payment(order)
report["Money_earned"] += Cash
continue
else:
print(f"Sorry but Your Order: {order} is not available")
continue
else:
break