-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoffeeMachine.py
More file actions
155 lines (135 loc) · 5.26 KB
/
Copy pathcoffeeMachine.py
File metadata and controls
155 lines (135 loc) · 5.26 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
145
146
147
148
149
150
151
152
153
154
155
# This is a coffee brewing project.
logo = """
.
`:.
`:.
.:' ,::
.:' ;:'
:: ;:'
: .:'
`. :.
_________________________
: _ _ _ _ _ _ _ _ _ _ _ _ :
,---:".".".".".".".".".".".".":
: ,'"`::.:.:.:.:.:.:.:.:.:.:.::'
`.`. `:-===-===-===-===-===-:'
`.`-._: :
`-.__`. ,'
,--------`"`-------------'--------.
`"--.__ __.--"'
`""-------------""'
"""
def report():
global storage
storage = {"water": 300, "milk": 200, "coffee": 100}
water = storage["water"]
milk = storage["milk"]
coffee = storage["coffee"]
return f"""
Water:{water}
Milk:{milk}
Coffee:{coffee}
"""
report()
def calculate_money():
global total_money
penny = int(input("how many pennies? ->"))
nickel = int(input("how many nickels? ->"))
dime = int(input("how many dimes? ->"))
quater = int(input("how many quaters? ->"))
total = [penny * 0.01, nickel * 0.05, dime * 0.10, quater * 0.25]
total_money = sum(total)
return total_money
def make_latte():
global latte
latte = {"water": 200, "milk": 150, "coffee": 24, "price": 2.50}
if latte["coffee"] > storage["coffee"]:
print("Sorry there is not enough coffee.")
elif latte["milk"] > storage["milk"]:
print("Sorry there is not enough milk.")
elif latte["water"] > storage["water"]:
print("Sorry there is not enough water.")
else:
calculate_money()
if latte["price"] < total_money:
print(
f"Your Coffee is on your way. Here is your {(round(total_money-latte['price'],2))} change."
)
storage["coffee"] -= latte["coffee"]
storage["milk"] -= latte["milk"]
storage["water"] -= latte["water"]
elif latte["price"] > total_money:
print("Sorry, that's not enough money. Money refunded")
else:
print("Thankyou for buying a Latte.Your Coffee is on your way.")
storage["coffee"] -= latte["coffee"]
storage["milk"] -= latte["milk"]
storage["water"] -= latte["water"]
def make_espresso():
global espresso
global end_of_program
espresso = {"water": 50, "milk": 0, "coffee": 18, "price": 1.50}
if espresso["coffee"] > storage["coffee"]:
print("Sorry there is not enough coffee.")
end_of_program = True
elif espresso["milk"] > storage["milk"]:
print("Sorry there is not enough milk.")
elif espresso["water"] > storage["water"]:
print("Sorry there is not enough water.")
end_of_program = True
else:
calculate_money()
if espresso["price"] < total_money:
print(
f"Your Coffee is on your way. Here is your {(round(total_money-espresso['price'],2))} change."
)
storage["coffee"] -= espresso["coffee"]
storage["milk"] -= espresso["milk"]
storage["water"] -= espresso["water"]
elif espresso["price"] > total_money:
print("Sorry, that's not enough money. Money refunded")
else:
print("Thankyou for buying an Espresso.Your Coffee is on your way.")
storage["coffee"] -= espresso["coffee"]
storage["milk"] -= espresso["milk"]
storage["water"] -= espresso["water"]
def make_cappuccino():
global cappuccino
cappuccino = {"water": 250, "milk": 100, "coffee": 24, "price": 3.00}
if cappuccino["coffee"] > storage["coffee"]:
print("Sorry there is not enough coffee.")
elif cappuccino["milk"] > storage["milk"]:
print("Sorry there is not enough milk.")
elif cappuccino["water"] > storage["water"]:
print("Sorry there is not enough water.")
else:
calculate_money()
if cappuccino["price"] < total_money:
print(
f"Your Coffee is on your way. Here is your {(round(total_money-cappuccino['price'],2))} change."
)
storage["coffee"] -= cappuccino["coffee"]
storage["milk"] -= cappuccino["milk"]
storage["water"] -= cappuccino["water"]
elif cappuccino["price"] > total_money:
print("Sorry, that's not enough money. Money refunded")
else:
print("Thankyou for buying an cappuccino.Your Coffee is on your way.")
storage["coffee"] -= cappuccino["coffee"]
storage["milk"] -= cappuccino["milk"]
storage["water"] -= cappuccino["water"]
end_of_program = False
while end_of_program == False:
print(logo)
order = input("What would you like? (espresso/latte/cappuccino):\n-->").lower()
if order == "report":
print(report())
elif order == "espresso":
make_espresso()
elif order == "latte":
make_latte()
elif order == "cappuccino":
make_cappuccino()
else:
print("Please enter a valid command")
print("Please re-fill the Machine with supplies.")