-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (28 loc) · 869 Bytes
/
main.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
import menu
import coffee_maker
import money_machine
option = menu.Menu()
machine = coffee_maker.CoffeeMaker()
money = money_machine.MoneyMachine()
def restart():
choice = input(f"What would you like? {option.get_items()}: ")
if choice == "off":
exit()
# TODO print report
elif choice == "report":
machine.report()
money.report()
restart()
else:
drink = option.find_drink(choice)
# TODO check resources sufficient?.
sufficient_resources = machine.is_resource_sufficient(drink)
if sufficient_resources:
# TODO process coins
payment = money.make_payment(drink.cost)
# TODO check transaction successful?
if payment:
# TODO make coffee
machine.make_coffee(drink)
restart()
restart()