-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
26 lines (23 loc) · 999 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
class CoffeeMachine:
def __init__(self):
from menu import Menu
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
self.machine_menu = Menu()
self.coffee_maker = CoffeeMaker()
self.money_machine = MoneyMachine()
self.machine_on = True
def sell_coffee(self):
while self.machine_on:
drink_choice = input(f"What would you like? ({self.machine_menu.get_items()}): ").lower()
if drink_choice == "report":
self.coffee_maker.report()
self.money_machine.report()
elif drink_choice == "off":
return False
else:
drink = self.machine_menu.find_drink(drink_choice)
if self.coffee_maker.is_resource_sufficient(drink) and self.money_machine.make_payment(drink.cost):
self.coffee_maker.make_coffee(drink)
coffee_machine = CoffeeMachine()
coffee_machine.sell_coffee()