from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine cmenu = Menu() cmaker = CoffeeMaker() mmachine = MoneyMachine() isOn = True #TODO Print Menu/Take Order while isOn: order = input(f"What would you like? {cmenu.get_items()}").lower() if order == "off": isOn = False print("Shutting down.") elif order == "report": cmaker.report() mmachine.report() elif order in cmenu.get_items(): orderitem = cmenu.find_drink(order) if cmaker.is_resource_sufficient(orderitem): paid = mmachine.make_payment(orderitem.cost) if paid: cmaker.make_coffee(orderitem) else: print("That is not a valid choice")
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine menu = Menu() coffeeMaker = CoffeeMaker() moneyMachine = MoneyMachine() makeCoffee = True while makeCoffee: order = input(f"Enter your order ({menu.get_items()}): ") if order == "report": coffeeMaker.report() moneyMachine.report() elif order == "off": makeCoffee = False else: drink = menu.find_drink(order) if drink is not None: menuItem = MenuItem(drink.name, drink.cost, drink.ingredients["water"], drink.ingredients["milk"], drink.ingredients["coffee"]) if coffeeMaker.is_resource_sufficient(drink): print("Please enter coins.") if moneyMachine.make_payment(menu.find_drink(order).cost): coffeeMaker.make_coffee(menu.find_drink(order))
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine # menu_item=MenuItem() menu_of_coffee=Menu() making_coffee=CoffeeMaker() machine_with_money=MoneyMachine() is_on = True while is_on : options = menu_of_coffee.get_items() name_of_coffee = input(f"Which type of coffee do you want ({options}): \n").lower() if name_of_coffee=="off": is_on=False elif name_of_coffee == "report": making_coffee.report() machine_with_money.report() else : drink=menu_of_coffee.find_drink(name_of_coffee) if making_coffee.is_resource_sufficient(drink) and machine_with_money.make_payment(drink.cost): making_coffee.make_coffee(drink)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine maker = CoffeeMaker() mm = MoneyMachine() menu = Menu() print("Welcome to the virtual coffee machine!") while True: prompt = "Type your choice. (" + menu.get_items() + "): " choice = input(prompt) item = menu.find_drink(choice) if item == None: continue sufficient = maker.is_resource_sufficient(item) if not sufficient: mm.report() break payment = mm.make_payment(item.cost) if not payment: continue maker.make_coffee(item) mm.report()
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine menu = Menu() coffee_maker = CoffeeMaker() money = MoneyMachine() time_break = True while time_break: choice = input(f"What drink would you like? {menu.get_items()}") if choice == "off": print("Machine powering off...") time_break = False elif choice == "report": coffee_maker.report() money.report() else: if coffee_maker.is_resource_sufficient( menu.find_drink(choice)) and money.make_payment( menu.find_drink(choice).cost): coffee_maker.make_coffee(menu.find_drink(choice))
from menu import Menu from coffee_maker import CoffeeMaker from money_machine import MoneyMachine my_menu = Menu() my_coffee_maker = CoffeeMaker() my_money_machine = MoneyMachine() is_machine_on = True while is_machine_on: command = input(f"What do you want to order? ({my_menu.get_items()})") if command == "report": my_coffee_maker.report() my_money_machine.report() elif command == "off": is_machine_on = False else: order = my_menu.find_drink(command) if order is None: continue if not my_coffee_maker.is_resource_sufficient(order): continue if not my_money_machine.make_payment(order.cost): continue my_coffee_maker.make_coffee(order) input("Enter to continue")
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine coffee_menu = Menu() coffees = coffee_menu.get_items() coffee_maker = CoffeeMaker() money_machine = MoneyMachine() machine_on = True while machine_on: order = input(f"What would you like? {coffees}\n") if order == "off": machine_on = False elif order == "report": coffee_maker.report() else: coffee = coffee_menu.find_drink(order) if coffee is not None: can_make = coffee_maker.is_resource_sufficient(coffee) if can_make: payment_successful = money_machine.make_payment(coffee.cost) if payment_successful: coffee_maker.make_coffee(coffee)
turn_off = False while not turn_off: default = input('Do you want to make a coffee? ').lower() clear() print(logo) if default == 'yes': print('\nThis coffee maker only makes Espresso, Latte and Cappuccino.') user_drink = input('What kind of coffee do you want? ').lower() available = menu.find_drink(user_drink) if available: if make_coffee.is_resource_sufficient(available): print( f'The price for {available.name} price is €{available.cost:.2f}' ) if payment.make_payment(available.cost): make_coffee.make_coffee(available) elif default == 'no': turn_off = True print('Okay.') elif default == 'off': turn_off = True print('The Coffee Maker is off.') elif default == 'report': print('Coffee Maker Report:') make_coffee.report() payment.report() else: print('Invalid response.\n')
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine from art import logo, priceboard drink_menu = Menu() coffee_ui = CoffeeMaker() money_machine = MoneyMachine() machine_on = True print(logo) print(priceboard) while machine_on == True: user_choice = input( f"What would you like? ({drink_menu.get_items()[:-1]}): ") menu_choice = drink_menu.find_drink(user_choice) if user_choice == "off": machine_on = False elif user_choice == "report": coffee_ui.report() money_machine.report() elif menu_choice != None: if coffee_ui.is_resource_sufficient(menu_choice): if money_machine.make_payment(menu_choice.cost): coffee_ui.make_coffee(menu_choice) os.system("cls") input("Press enter to exit...")
money_operations = MoneyMachine() user_drink = Menu() while KEEP_WORKING: drinks_that_can_be_made = Menu() user_choice = input( f'What would you like? ({drinks_that_can_be_made.get_items()}): ' ).lower() if user_choice == 'off': print('Coffee machine is off') KEEP_WORKING = False elif user_choice == 'report': ingredients_information.report() money_operations.report() else: user_drink_name = user_drink.find_drink(user_choice) if user_drink_name is None: continue else: ingredients_are_ok = ingredients_information.is_resource_sufficient( user_drink_name) if ingredients_are_ok: user_drink_cost = user_drink_name.cost payment_process = money_operations.make_payment(user_drink_cost) if payment_process: ingredients_information.make_coffee(user_drink_name)
moneybags = MoneyMachine() maker = CoffeeMaker() alive = True def print_report(): global maker global moneybags maker.report() moneybags.report() def turn_off(): global alive alive = False while alive: cmd = input(f"What would you like? ({menu.get_items()}): ") if cmd == "off": turn_off() elif cmd == "report": print_report() else: drink = menu.find_drink(cmd) if maker.is_resource_sufficient(drink): if moneybags.make_payment(drink.cost): maker.make_coffee(drink)
Type "off" to log out from the machine.\033[m ''') menu = Menu() money_machine = MoneyMachine() coffee_maker = CoffeeMaker() is_on = True while is_on: welcome() options = menu.get_items() user_choice = str( input(f'What would you like?\nOptions ({options}): ')).strip().lower() if user_choice == 'off': print('\033[31m<<THE END>>\033[m') is_on = False elif user_choice == 'report': coffee_maker.report() money_machine.report() elif menu.find_drink(user_choice) is None: print('\033[31mError. Please choose an available option.\033[m') else: beverage = menu.find_drink(user_choice) #Encapsulates the result sufficient_resources = coffee_maker.is_resource_sufficient( beverage) #TrueFalse result sufficient_money = money_machine.make_payment(beverage.cost) if sufficient_resources and sufficient_money: print('Done! Allow us to make your beverage now.') coffee_maker.make_coffee(beverage)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine m = Menu() cm = CoffeeMaker() mm = MoneyMachine() turn_off = False while not turn_off: user_selection = input(f"What would you like to have? {m.get_items()}:") if user_selection == "off": print("Machine is turning OFF. BYE BYE...") turn_off = True elif user_selection == "report": cm.report() mm.report() else: item = m.find_drink(user_selection) if item is None: print("We have only three options available.") can_make = cm.is_resource_sufficient(item) if can_make is True: mm.make_payment(item.cost) cm.make_coffee(item)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine menu = Menu() options = menu.get_items() money_machine = MoneyMachine() coffe_maker = CoffeeMaker() is_on = True while is_on: user_input = input(f"What would you like? ({options}): ").lower() if user_input == "off": is_on = False elif user_input == "report": coffe_maker.report() money_machine.report() else: choice = menu.find_drink(user_input) if choice != None: if money_machine.make_payment( choice.cost) and coffe_maker.is_resource_sufficient( choice): coffe_maker.make_coffee(choice)
from menu import Menu from coffee_maker import CoffeeMaker from money_machine import MoneyMachine obj_coffee_maker = CoffeeMaker() obj_menu = Menu() obj_money_machine = MoneyMachine() is_machine_on = True while is_machine_on: command = input(f"What would you like? {obj_menu.get_items()}: ") if command == "report": obj_coffee_maker.report() elif command == "off": is_machine_on = False else: drink = obj_menu.find_drink(command) if drink is not None: if obj_coffee_maker.is_resource_sufficient(drink): if obj_money_machine.make_payment(drink.cost): obj_coffee_maker.make_coffee(drink)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine coffee_machine = CoffeeMaker() coffee_menu = Menu() money_machine = MoneyMachine() operationOver = False while not operationOver: print(coffee_menu.get_items()) user_command = input( "Select the drink from the menu or type 'report' to issue a report ") if user_command == 'report': print(coffee_machine.report(), money_machine.report()) else: menu_item_choice = coffee_menu.find_drink(user_command) # if there are enough resources and the user made enough payment we dispense the drink if coffee_machine.is_resource_sufficient( menu_item_choice) and money_machine.make_payment( menu_item_choice.cost): coffee_machine.make_coffee(menu_item_choice)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine # Instantiating objects from imported classes my_coffee_menu = Menu() my_coffee_maker = CoffeeMaker() my_money_machine = MoneyMachine() # Begin coffee machine with OOP! response = "" while response != "off": menu_items = my_coffee_menu.get_items() response = input(f"What would you like? ({menu_items}): ") if response == "off": break elif response == "report": my_coffee_maker.report() my_money_machine.report() else: drink = my_coffee_menu.find_drink(response) drink_cost = drink.cost if not my_coffee_maker.is_resource_sufficient(drink): print(f"Sorry there is not enough ingredients for {response}.") continue if not my_money_machine.make_payment(drink_cost): continue my_coffee_maker.make_coffee(drink)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine money_machine = MoneyMachine() coffee_maker = CoffeeMaker() menu = Menu() 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": coffee_maker.report() money_machine.report() else: drink = menu.find_drink(choice) is_enough_ingredients = coffee_maker.is_resource_sufficient(drink) is_payment_successful = money_machine.make_payment(drink.cost) if is_enough_ingredients and is_payment_successful: print(coffee_maker.make_coffee(drink))
from coffee_maker import CoffeeMaker from menu_item import MenuItem menuItem = MenuItem(name="latte", water=100, milk=0, coffee=24, cost=2.5) cm = CoffeeMaker() cm.report() print(cm.is_resource_sufficient(menuItem)) cm.make_coffee(menuItem) cm.report()
money_machine = MoneyMachine() menu = Menu() machine_on = True while machine_on: menu_options = menu.get_items() order = input(f"What would you like? {menu_options}: ") if order == "off": machine_on = False # TODO 1: Print report elif order == "report": coffee_maker.report() money_machine.report() else: # TODO 2: Check resources coffee_order = menu.find_drink(order) # TODO 3: Process Coins # TODO 4: Check order successful ''' we can use this sintax of code is_enough_ingredients = coffee_maker.is_resource_sufficient(coffee_order) is_payment_successful = money_machine.make_payment(coffee_order.cost) if is_enough_ingredients and is_payment_successful: ''' if coffee_maker.is_resource_sufficient( coffee_order) and money_machine.make_payment( coffee_order.cost): # TODO 5: Deliver the order coffee_maker.make_coffee(coffee_order)
from money_machine import MoneyMachine """ print report check resources are sufficient process coins """ money_machine = MoneyMachine() money_machine.report() coffee = CoffeeMaker() coffee.report() menu = Menu() 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": coffee.report() money_machine.report() else: drink = menu.find_drink(choice) print(drink) if coffee.is_resource_sufficient(drink): if money_machine.make_payment(drink.cost): coffee.make_coffee(drink)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine money_machine = MoneyMachine() coffee_maker = CoffeeMaker() menu = Menu() item = Menu.get_items(Menu()) cho = input(f"What would you like? ({item}): ") while cho != 'off': if cho == 'report': coffee_maker.report() money_machine.report() else: espr = menu.find_drink(cho) if coffee_maker.is_resource_sufficient(espr): if money_machine.make_payment(menu.find_drink(cho).cost): coffee_maker.make_coffee(espr) cho = input(f"What would you like? ({item}): ")
if __name__ == "__main__": running = True coffee_bot = CoffeeMaker() coffee_bot_menu = Menu() money_bank = MoneyTracker() while running: """ get_items will return drink names and prices """ print("\nWelcome to coffee-bot ☕") print( f"I serve the following hot drinks: {coffee_bot_menu.get_items()}") order_code = input( "Enter the first letter of the menu item to make an order: " ).lower() if order_code == 'off': running = False elif order_code == 'report': coffee_bot.report() money_bank.report() else: if not coffee_bot_menu.find_drink(order_code): print("Enter an item from the menu.") else: drink_choice = coffee_bot_menu.find_drink(order_code) if coffee_bot.is_resource_sufficient(drink_choice): if money_bank.make_payment(drink_choice.cost): coffee_bot.make_coffee(drink_choice) else: print("Try ordering something else.")
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine money_machine = MoneyMachine() coffee_maker = CoffeeMaker() menu = Menu() is_machine_on = True while is_machine_on: options = menu.get_items() choice = input(f"What would you like to drink? {options}: ") if choice == "reports": coffee_maker.report() money_machine.report() elif choice == "off": is_machine_on = False else: item = menu.find_drink(choice) if item is not None: if coffee_maker.is_resource_sufficient(item): # money_received = money_machine.process_coins() if money_machine.make_payment(item.cost): coffee_maker.make_coffee(item)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine mn = Menu() cm = CoffeeMaker() mon = MoneyMachine() con = True while (con): options = mn.get_items() inp = input(f"Which drink do you want {options} :") if inp == 'report': cm.report() mon.report() elif inp == 'off': con = False else: drink = mn.find_drink(inp) is_enough_ingredients = cm.is_resource_sufficient(drink) is_payment_successful = mon.make_payment(drink.cost) if is_enough_ingredients and is_payment_successful: cm.make_coffee(drink)
################################### from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine drinks_menu = Menu() drinks_maker = CoffeeMaker() transaction_handler = MoneyMachine() on = True while on: user_choice = input('What would you like to drink ({})?: '.format( drinks_menu.get_items())).lower() if user_choice in ['report', 'off'] or drinks_menu.find_drink(user_choice): if user_choice == 'off': # Handle secret keyword 'off' on = False elif user_choice == 'report': # Handle secret keyword 'report' drinks_maker.report() transaction_handler.report() else: # Make the appropriate drink drink = drinks_menu.find_drink(user_choice) if drinks_maker.is_resource_sufficient(drink): print('A {} costs ${}...'.format(drink.name, drink.cost)) if transaction_handler.make_payment(drink.cost): drinks_maker.make_coffee(drink)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine is_on = True drinks_menu = Menu() coffe_machine = CoffeeMaker() moneybox = MoneyMachine() while is_on: text = input(f"What would you like? {drinks_menu.get_items()}:").lower() if text == 'off': is_on = False elif text == 'report': coffe_machine.report() moneybox.report() else: drink = drinks_menu.find_drink(text) if(drink): if(coffe_machine.is_resource_sufficient(drink)): if(moneybox.make_payment(drink.cost)): coffe_machine.make_coffee(drink) # example change
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine coin_bot = MoneyMachine() java_machina = CoffeeMaker() get_bot = Menu() system_on = True while system_on: selection = get_bot.get_items() choice = input(f"Please make a selection {selection}: ") if choice == "off": system_on = False elif choice == "report": java_machina.report() coin_bot.report() else: drink = get_bot.find_drink(choice) if java_machina.is_resource_sufficient(drink): if coin_bot.make_payment(drink.cost): java_machina.make_coffee(drink)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine cash_register = MoneyMachine() coffee_maker = CoffeeMaker() menu = Menu() on = True while on: options = menu.get_items() choix = input(f"What'll it be? {options}") if choix == 'off': on = False elif choix == 'report': cash_register.report() coffee_maker.report() else: drink = menu.find_drink(choix) enough_stuff = coffee_maker.is_resource_sufficient(drink) enough_money = cash_register.make_payment(drink.cost) if enough_stuff and enough_money: coffee_maker.make_coffee(drink)
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine menu = Menu() coffee_machine = CoffeeMaker() money_machine = MoneyMachine() while True: money_machine.money_received = 0 coffee = input(f"What would you like? {menu.get_items()}:\n").lower() order = menu.find_drink(order_name=coffee) if order is not None: is_enough_resources = coffee_machine.is_resource_sufficient(order) if is_enough_resources: is_processed = money_machine.make_payment(order.cost) if is_processed: coffee_machine.make_coffee(order) choice = input( "Do you want to make another order?(Y/N):\n").lower() if choice != "y": break