day 16 - OOP inside !

This commit is contained in:
Tanguy Deleplanque
2025-06-24 10:56:01 +02:00
parent ad068f268d
commit a2691e1e06
4 changed files with 125 additions and 0 deletions

22
016/main.py Normal file
View File

@ -0,0 +1,22 @@
from menu import Menu
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
my_coffee_maker = CoffeeMaker()
my_menu = Menu()
my_money_machine = MoneyMachine()
is_on = True
while is_on == True:
choice = input(f"What would you like? ({my_menu.get_items()}):")
if choice == "report":
my_coffee_maker.report()
my_money_machine.report()
elif choice == "off":
is_on = False
else:
order = my_menu.find_drink(choice)
if order and my_coffee_maker.is_resource_sufficient(order) and my_money_machine.make_payment(order.cost):
my_coffee_maker.make_coffee(order)