-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVirtual Coffee Machine(Project-9).py
More file actions
144 lines (77 loc) · 2.72 KB
/
Virtual Coffee Machine(Project-9).py
File metadata and controls
144 lines (77 loc) · 2.72 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Menu={
"Latte":{
"Ingredients":{
"Water":200,
"Milk":150,
"Coffee":24,
},
"Cost":150,
},
"Espresso":{
"Ingredients":{
"Water":50,
"Coffee":18,
},
"Cost":100,
},
"Cappuccino":{
"Ingredients":{
"Water":250,
"Milk":100,
"Coffee":24,
},
"Cost":200,
}
}
Profit=0
Resources={
"Water":500,
"Milk":200,
"Coffee":100,
}
def Check_Resources(Order_Ingredients):
for item in Order_Ingredients: #water #milk #coffee
if Order_Ingredients[item]>Resources[item]:
print(f"Sorry there is not enough {item}.")
return False
return True
def Process_Coins():
print("Please Insert coins.")
Total=0
Coins_Five=int(input("How Many 5rs. Coins?"))
Coins_Ten=int(input("How Many 10rs. Coins?"))
Coins_Twenty=int(input("How Many 20rs Coins?"))
Total=Coins_Five*5 + Coins_Ten*10 + Coins_Twenty*20
return Total
def Is_Payment_Successful(Money_Received,Coffee_Cost):
if Money_Received >= Coffee_Cost:
global Profit
Profit += Coffee_Cost
Change=Money_Received - Coffee_Cost
print(f"Here is your Rs: {Change} in change.")
return True
else:
print("Sorry that's no enough money. Money Refunded.")
return False
def Make_Coffee(Coffee_Name,Coffee_Ingredients):
for item in Coffee_Ingredients:
Resources[item]-= Coffee_Ingredients[item]
print(f"Here is your {Coffee_Name}....☕ Enjoy:)!!!")
Is_on=True
while Is_on:
Choice=input("What would you like to have?-> (Latte/Espresso/Cappuccino)")
if Choice == "Off":
Is_on=False
elif Choice == "Report":
print(f"Water = {Resources['Water']}ml")
print(f"Milk = {Resources['Milk']}ml")
print(f"Coffee = {Resources['Coffee']}g")
print(f"Money= Rs{Profit}")
else:
Coffee_Type=Menu[Choice]
print(Coffee_Type)
if Check_Resources(Coffee_Typ
e['Ingredients']):
Payment=Process_Coins()
if Is_Payment_Successful(Payment,Coffee_Type['Cost']):
Make_Coffee(Choice,Coffee_Type['Ingredients'])