DEV Community

Mike Kameta
Mike Kameta

Posted on • Updated on

100 Days of Code: The Complete Python Pro Bootcamp for 2022 - Day 16 (Object Oriented Programming)

  • I imported the code as provided by the course and all I needed to do was complete this project using OOP instead of Procedural Programming. This was a carry on or next step for the original Coffee Machine Maker for Day 15
from menu import Menu, MenuItem
from coffe_maker import CoffeeMaker
from money_machine import MoneyMachine

menu = Menu()
menu_item = MenuItem('name', 'water', 'milk', 'coffee', 'cost')
coffee_maker = CoffeeMaker()
money_machine = MoneyMachine()
is_on = True

while is_on:
    options = menu.get_items()
    choice = input(f"What would you like? ({options}): ")
    if choice == "off":
        is_on = False
    elif choice == "report":
        drink = menu.find_drink(choice)
        if coffee_maker.is_resource_sufficient(drink) and money_machine.make_payment(drink.cost):
Enter fullscreen mode Exit fullscreen mode

Top comments (0)