Advertisement
JkSoftware

Day 16 - main.py

Nov 25th, 2021
879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. from menu import Menu, MenuItem
  2. from coffee_maker import CoffeeMaker
  3. from money_machine import MoneyMachine
  4.  
  5.  
  6. # DONE print report
  7. # DONE Check Resources Suffucient
  8. # DONE Process Coins
  9. # DONE Check Transaction Successful
  10. # DONE Make Coffee
  11.  
  12.  
  13. money_machine = MoneyMachine()
  14. coffee_maker = CoffeeMaker()
  15. menu = Menu()
  16. is_on = True
  17.  
  18.  
  19. while is_on:
  20.     options = menu.get_items()
  21.     choice = input(f"What would you like? ({options})").lower()
  22.     if choice == "off":
  23.         is_on = False
  24.     elif choice == "report":
  25.         coffee_maker.report()
  26.         money_machine.report()
  27.     else:
  28.         drink = menu.find_drink(choice)
  29.         if coffee_maker.is_resource_sufficient(drink):
  30.             if money_machine.make_payment(drink.cost):
  31.                 coffee_maker.make_coffee(drink)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement