Пример #1
0
 def setUp(self):
     self.logPoint()
     self.mango_lasi3 = Drink("mango lasis", 10, datetime.date(2017, 9,
                                                               12), 12.99,
                              80, "lasi producer ltd", 129.99, False, False)
     self.menu_item_manager = MenuItemManager(
         'C:/Users/user/Desktop/ACIT2515_ASSIGNMENT3-master/test_menu.json')
Пример #2
0
def run_tests():  # DO NOT pass a List into function because it is mutable!!!
    d = DrinkList()
    drink1 = Drink("Pina Colada", 12.3, 450, 12.5)
    drink2 = Drink("Coffee", 4.5, 280, 0)
    d.add(drink1)
    d.add(drink1)
    d.add(drink2)
    print(d)
    print(d.get_number_alcoholic())
    print(d.get_alcohol_volume())
Пример #3
0
def run_tests():
    d = DrinkList()
    drink1 = Drink("Pina Colada", 12.3, 450, 12.5)
    drink2 = Drink("Coffee", 4.5, 280, 0)
    d.add(drink1)
    d.add(drink1)
    d.add(drink2)
    print(d)
    print(d.get_number_alcoholic())
    print(d.get_alcohol_volume())
    def test_update(self):
        """ 080A: Valid Update """

        self.logPoint()

        self.kashmir_dosa.add_menu_item(self.barley_bread)
        self.kashmir_dosa.add_menu_item(self.mango_lasi3)

        mango_lasi = Drink("mango lasi", 8, "2017-9-12", 6.99, 80,
                           "lasi producer ltd", 129.99, False, False)

        mango_lasi.set_id(1)

        self.kashmir_dosa.update(mango_lasi)
def update_menu_item(id):
    """ updates an existing menu item """
    content = request.json

    if menu_item_manager.menu_exist(id) is True:

        for item in content:
            if content['type'] == 'food':
                menu_item = Food(
                    content['menu_item_name'], content['menu_item_no'],
                    (content['date_added']), content['price'],
                    content['calories'], content['cuisine_country'],
                    content['main_ingredient'], content['portion_size'],
                    content['is_vegetarian'])
                menu_item.set_id(id)
                menu_item_manager.update(menu_item)
            elif content['type'] == 'drink':
                menu_item = Drink(content['menu_item_name'],
                                  content['menu_item_no'],
                                  content['date_added'], content['price'],
                                  content['calories'], content['manufacturer'],
                                  content['size'], content['is_fizzy'],
                                  content['is_hot'])
                menu_item.set_id(id)
                menu_item_manager.update(menu_item)

        a = menu_item_manager.get_all_by_type(content['type'])

        response = app.response_class(status=200, mimetype='/application/json')
    else:
        response = app.response_class(
            status=404, response='device with given id does not exist')

    return response
Пример #6
0
    def buy(self, i, kind_of_drink):

        if (i != 100) and (i != 500):
            self.change += i
            return None

        if (kind_of_drink == Drink.COKE) and (self.quantity_of_coke == 0):
            self.change += i
            return None
        elif (kind_of_drink == Drink.DIET_COKE) and \
                (self.quantity_of_diet_coke == 0):
            self.change += i
            return None
        elif (kind_of_drink == Drink.TEA) and (self.quantity_of_tea == 0):
            self.change += i
            return None

        if i == 500 and self.number_of_100_yen < 4:
            self.change += i
            return None

        if i == 100:
            self.number_of_100_yen += 1
        elif i == 500:
            self.change += (i - 100)
            self.number_of_100_yen -= (i - 100) / 100

        if kind_of_drink == Drink.COKE:
            self.quantity_of_coke -= 1
        elif kind_of_drink == Drink.DIET_COKE:
            self.quantity_of_diet_coke -= 1
        else:
            self.quantity_of_tea -= 1

        return Drink(kind_of_drink)
Пример #7
0
    def test_update(self):
        """ 080A: Valid Update """

        self.logPoint()

        self.kashmir_dosa.add_menu_item(self.barley_bread)
        self.kashmir_dosa.add_menu_item(self.mango_lasi3)

        mango_lasi = Drink("mango lasi", 8, datetime.date(2017, 9, 12), 6.99,
                           80, "lasi producer ltd", 129.99, False, False)

        mango_lasi.set_id(2)

        self.kashmir_dosa.update(mango_lasi)

        self.assertEqual(self.kashmir_dosa.get_by_id(2).get_price(), 6.99)
def add_item():
    """ add a menu item """
    content = request.json
    try:
        for item in content:
            if content['type'] == 'food':
                menu_item = Food(
                    content['menu_item_name'], content['menu_item_no'],
                    datetime.strptime(content['date_added'], '%Y-%m-%d'),
                    content['price'], content['calories'],
                    content['cuisine_country'], content['main_ingredient'],
                    content['portion_size'], content['is_vegetarian'])

            elif content['type'] == 'drink':
                menu_item = Drink(
                    content['menu_item_name'], content['menu_item_no'],
                    datetime.strptime(content['date_added'],
                                      '%Y-%m-%d'), content['price'],
                    content['calories'], content['manufacturer'],
                    content['size'], content['is_fizzy'], content['is_hot'])

        menu_item_manager.add_menu_item(menu_item)

        response = app.response_class(status=200)

    except ValueError as e:
        response = app.response_class(response=str(e), status=400)

    return response
Пример #9
0
def main():
    barley_bread = Food("barley bread", 12, datetime.date(2018, 8, 8), 12.99,
                        149, "India", "Barley", "small", True)

    mango_lasi3 = Drink("mango lasis", 10, datetime.date(2017, 9, 12), 12.99,
                        80, "lasi producer ltd", 129.99, False, False)
    print(mango_lasi3.menu_item_description())
    mango_lasi3.set_id(2)

    kashmir_dosa = MenuItemManager("kashmir dosa")
    kashmir_dosa.add_menu_item(barley_bread)

    kashmir_dosa.add_menu_item(mango_lasi3)

    print_report(kashmir_dosa)

    print(kashmir_dosa.menu_exist(3))
Пример #10
0
def get_drink_request():

    if request.method == 'POST':
        return our_drink_machine.make_drink(
            Drink(request.json["pumpOne"], request.json["pumpTwo"]))
    elif request.method == 'GET':
        return our_drink_machine.current_drink_progress()

    return "error occured"
Пример #11
0
def create_drink_and_add_to_list_and_return_new_list(_drinks):
    # create drink
    drink_id = get_id_of_list_item_in_list_and_add_one(_drinks)
    drink_name = input_handle.get_valid_name("drink name").lower()
    drink = Drink(drink_id, drink_name)

    # add drink to list
    _drinks.append(drink)
    return _drinks
Пример #12
0
def load_drinks(filename):
    all_drinks = []
    input_file = open(filename)
    for line in input_file:
        parts = line.strip().split(',')
        # print(parts)
        all_drinks.append(Drink(parts[0], float(parts[1]), float(parts[2]), float(parts[3])))
    input_file.close()
    return all_drinks
    def setUp(self):
        """Set up for all the values"""
        self.logPoint()
        self.kashmir_dosa = MenuItemManager("kashmir dosa")
        self.barley_bread = Food("barley bread", 12, datetime.date(2018, 8, 8), 12.99, 149, "India", "Barley", "small", True)

        self.mango_lasi3 = Drink("mango lasis", 10, datetime.date(2017, 9, 12), 12.99, 80, "lasi producer ltd", 129.99,
                            False, False)

        self.undefined_value = None
        self.empty_value = ""
    def buy(self, i, kind_of_drink):
        '''
        ジュースを購入する.
        Parameters
        ----------
        i            : 投入金額. 100円と500円のみ受け付ける.
        kind_of_drink: ジュースの種類. コーラ({@code Juice.COKE}),ダイエットコーラ({@code Juice.DIET_COKE},お茶({@code Juice.TEA})が指定できる.

        Returns
        -------
        指定したジュース. 在庫不足や釣り銭不足で買えなかった場合は None が返される.
        '''

        # 100円と500円だけ受け付ける
        if (i != 100) and (i != 500):
            self.charge += i
            return None

        if (kind_of_drink == Drink.COKE) and (self.quantity_of_coke == 0):
            self.charge += i
            return None
        elif (kind_of_drink == Drink.DIET_COKE) and \
                (self.quantity_of_diet_coke == 0):
            self.charge += i
            return None
        elif (kind_of_drink == Drink.TEA) and (self.quantity_of_tea == 0):
            self.charge += i
            return None

        # 釣り銭不足
        if i == 500 and self.number_of_100_yen < 4:
            self.charge += i
            return None

        if i == 100:
            # 100円玉を釣り銭に使える
            self.number_of_100_yen += 1
        elif i == 500:
            # 400円のお釣り
            self.charge += (i - 100)
            # 100円玉を釣り銭に使える
            self.number_of_100_yen -= (i - 100) / 100

        if kind_of_drink == Drink.COKE:
            self.quantity_of_coke -= 1
        elif kind_of_drink == Drink.DIET_COKE:
            self.quantity_of_diet_coke -= 1
        else:
            self.quantity_of_tea -= 1

        return Drink(kind_of_drink)
    def test_update(self):
        """ 080A: Valid Update """

        self.logPoint()

        self.kashmir_dosa.add_menu_item(self.barley_bread)
        self.kashmir_dosa.add_menu_item(self.mango_lasi3)

        mango_lasi = Drink("mango lasi5", 8, datetime.datetime.now(), 6.99, 80,
                           "lasi producer ltd", 129.99, False, False)

        self.kashmir_dosa.update(2, mango_lasi)

        self.assertEqual(self.kashmir_dosa.get_all()[1], "mango lasi5")
    def setUp(self):
        """Set up for all the values"""
        self.logPoint()

        self.kashmir_dosa = MenuItemManager(
            'D:/OOP/Assignment3/v1.2/test_menu1.json')
        self.barley_bread = Food("barley bread", 12, "2012-02-02", 12.99, 149,
                                 "India", "Barley", "small", True)

        self.mango_lasi3 = Drink("mango lasis", 10, "2012-02-02", 12.99, 80,
                                 "lasi producer ltd", 129.99, False, False)

        self.undefined_value = None
        self.empty_value = ""
Пример #17
0
 def load_drinkers(self, con):
     cur = con.cursor()
     cur.execute('SELECT * FROM drinkers')
     for row in cur:
         drinker = Drinker(Drink(con, None, row[6]), self.remove_drinker,
                           self.set_drink, con)
         drinker.name = row[0]
         drinker.weight = row[1]
         drinker.male = row[2]
         drinker.alcohol = row[3]
         drinker.started = row[4]
         drinker.tab = row[5]
         drinker.fill_fields()
         self.add_drinker(drinker)
     cur.close()
    def test_get_menu_item_stats(self):

        self.logPoint()
        """090A Check the stats of the menu"""

        mango_lasi = Drink("mango lasi", 8, datetime.datetime.now(), 6.99, 80,
                           "lasi producer ltd", 129.99, False, False)

        self.kashmir_dosa.add_menu_item(self.barley_bread)
        self.kashmir_dosa.add_menu_item(self.mango_lasi3)
        self.kashmir_dosa.add_menu_item(mango_lasi)

        stats = self.kashmir_dosa.get_menu_item_stats()
        stats_dict = stats.to_dict()
        self.assertEqual(stats_dict['_total_num_menu_items'], 3)
Пример #19
0
    def addNewDrink(screen, name="", drink_type="", recipe=None):
        UI.clearScreen(screen)

        curses.nocbreak()
        screen.keypad(False)
        curses.echo()

        if not name:
            name = UI.cursedInput("Enter name of drink: ")
        if not drink_type:
            drink_type = UI.cursedInput("Enter type of drink: ")
        if not recipe:
            recipe = UI.cursedInput("Enter recipe of drink (keep it short):")
        _drinks.append(Drink(name, drink_type, recipe))

        curses.cbreak()
        screen.keypad(True)
        curses.noecho()
    def test_get_menu_item_stats(self):

        self.logPoint()
        """090A Check the stats of the menu"""

        mango_lasi = Drink("mango lasi", 8, datetime.date(2017, 9, 12), 6.99, 80, "lasi producer ltd", 129.99, False,
                           False)

        self.kashmir_dosa.add_menu_item(self.barley_bread)
        self.kashmir_dosa.add_menu_item(self.mango_lasi3)
        self.kashmir_dosa.add_menu_item(mango_lasi)

        stats = self.kashmir_dosa.get_menu_item_stats()

        self.assertEqual(stats.get_num_foods(), 1)
        self.assertEqual(stats.get_num_drinks(), 2)
        self.assertEqual(stats.get_avg_price_food(), 12.990000)
        self.assertEqual(stats.get_avg_price_drink(), 9.990000)
    def setUp(self):
        """Set up for all the values"""

        engine = create_engine('sqlite:///test_menu.sqlite')

        Base.metadata.create_all(engine)
        Base.metadata.bind = engine

        self.logPoint()

        self.kashmir_dosa = MenuItemManager('Kashmir Dosa', "test_menu.sqlite")

        self.barley_bread = Food("barley bread", 12, datetime.datetime.now(),
                                 12.99, 149, "India", "Barley", "small", True)

        self.mango_lasi3 = Drink("mango lasis", 10, datetime.datetime.now(),
                                 12.99, 80, "lasi producer ltd", 129.99, False,
                                 False)

        self.undefined_value = None
        self.empty_value = ""
Пример #22
0
from food import Food
from drink import Drink
import sys

food1 = Food('注文しない', 0, 0)
food2 = Food('ハンバーガー', 100, 250)
food3 = Food('チーズバーガー', 150, 300)
food4 = Food('フィッシュバーガー', 200, 320)

foods = [food1, food2, food3, food4]

drink1 = Drink('注文しない', 0, 0)
drink2 = Drink('コーラ', 120, 350)
drink3 = Drink('コーヒー', 150, 350)
drink4 = Drink('ミルク', 80, 200)

drinks = [drink1, drink2, drink3, drink4]

print('メニューを表示します')
# print('3点以上ご注文いただくと、総額より一割引となります')
print('--------------------')
print('フードメニュー')
index = 0
for food in foods:
  print(str(index) + ':' + food.info())
  index += 1

index = 0
print('ドリンクメニュー')
for drink in drinks:
  print(str(index) + ':' + drink.info())
Пример #23
0
def create_drinks_menu():
    drinks = dict()
    d = Drink('ScrewdriverStraight', 'Screwdriver (straight)')
    d.recipe = dict(Vodka=50, OrangeJuice=100)
    d.description = r"""A screwdriver is a popular alcoholic highball drink made with orange juice and vodka. The International Bartender Association has designated this cocktail as an IBA Official Cocktail."""
    d.human_readable_recipe = ["50 mL vodka", "100 mL orange juice"]
    drinks[d.id] = d

    d = Drink('ScrewdriverOtr', 'Screwdriver (on the rocks)')
    d.recipe = dict(Vodka=50, OrangeJuice=100, IceCube=5)
    d.description = r"""A screwdriver is a popular alcoholic highball drink made with orange juice and vodka. The International Bartender Association has designated this cocktail as an IBA Official Cocktail."""
    d.human_readable_recipe = ["50 mL vodka", "100 mL orange juice", "ice cubes"]
    drinks[d.id] = d

    d = Drink('OjStraight', 'Orange Juice (straight)')
    d.recipe = dict(OrangeJuice=150)
    d.description = r"""Orange juice is made by squeezing the fresh fruit, by drying and later rehydrating the juice, or by concentration of the juice and later adding water to the concentrate. It is known for its health benefits, particularly its high concentration of vitamin C. In American English, the slang term O.J. may also be used to refer to orange juice."""
    d.human_readable_recipe = ["150 mL orange juice"]
    drinks[d.id] = d

    d = Drink('OjOtr', 'Orange Juice (on the rocks)')
    d.recipe = dict(OrangeJuice=150, IceCube=5)
    d.description = r"""Orange juice is made by squeezing the fresh fruit, by drying and later rehydrating the juice, or by concentration of the juice and later adding water to the concentrate. It is known for its health benefits, particularly its high concentration of vitamin C. In American English, the slang term O.J. may also be used to refer to orange juice."""
    d.human_readable_recipe = ["150 mL orange juice", "ice cubes"]
    drinks[d.id] = d

    d = Drink('BacardiStraight', 'Bacardi (straight)')
    d.recipe = dict(Bacardi=50)
    d.description = r"""Bacardi Limited (English: /bəˈkɑrdi/; Catalan: [bəkəɾˈði]; Spanish: [bakarˈði]) is the largest privately held, family-owned spirits company in the world. Originally known for its eponymous Bacardi white rum, it's now also known for its brand portfolio comprising more than 200 brands and labels."""
    d.human_readable_recipe = ["50 mL Bacardi rum"]
    drinks[d.id] = d

    d = Drink('BacardiOtr', 'Bacardi (on the rocks)')
    d.recipe = dict(Bacardi=50, IceCube=5)
    d.description = r"""Bacardi Limited (English: /bəˈkɑrdi/; Catalan: [bəkəɾˈði]; Spanish: [bakarˈði]) is the largest privately held, family-owned spirits company in the world. Originally known for its eponymous Bacardi white rum, it's now also known for its brand portfolio comprising more than 200 brands and labels."""
    d.human_readable_recipe = ["50 mL Bacardi rum", "ice cubes"]
    drinks[d.id] = d

    d = Drink('BacardiOrangeStraight', 'Bacardi Orange (straight)')
    d.recipe = dict(Bacardi=50, OrangeJuice=100)
    d.description = r"""A fresh high ball with Bacardi white rum and orange juice."""
    d.human_readable_recipe = ["50 mL Bacardi rum"]
    drinks[d.id] = d

    d = Drink('BacardiOrangeOtr', 'Bacardi Orange (on the rocks)')
    d.recipe = dict(Bacardi=50, OrangeJuice=100, IceCube=5)
    d.description = r"""A fresh high ball with Bacardi white rum and orange juice."""
    d.human_readable_recipe = ["50 mL Bacardi rum", "ice cubes"]
    drinks[d.id] = d

    return drinks
Пример #24
0
from food import Food
from drink import Drink
# For error handling;
import sys

food1 = Food('Sandwich', 50, 330)
food2 = Food('Chocolate Cake', 40, 450)
food3 = Food('Cream Puff', 20, 180)

foods = [food1, food2, food3]

drink1 = Drink('Coffee', 30, 180)
drink2 = Drink('Orange Juice', 20, 350)
drink3 = Drink('Espresso', 30, 30)

drinks = [drink1, drink2, drink3]
print('--------------------')
print('Food')

for index, food in enumerate(foods):
    print(str(index) + '. ' + food.info())

print('--------------------')
print('Drinks')

for index, drink in enumerate(drinks):
    print(str(index) + '. ' + drink.info())
    index += 1

print('--------------------')
Пример #25
0
from food import Food
from drink import Drink

food1 = Food('サンドイッチ', 500, 330)
food2 = Food('チョコケーキ', 400, 450)
food3 = Food('シュークリーム', 200, 180)

foods = [food1, food2, food3]

drink1 = Drink('コーヒー', 300, 180)
drink2 = Drink('オレンジジュース', 200, 350)
drink3 = Drink('エスプレッソ', 300, 30)

drinks = [drink1, drink2, drink3]

print('食べ物メニュー')
index = 0
for food in foods:
    print(str(index) + '. ' + food.info())
    index += 1

print('飲み物メニュー')
index = 0
for drink in drinks:
    print(str(index) + '. ' + drink.info())
    index += 1

print('--------------------')

food_order = int(input('食べ物の番号を選択してください: '))
selected_food = foods[food_order]
Пример #26
0
from food import Food
from drink import Drink

food1 = Food('Roti Lapis', 5)
food1.calorie_count = 330
print(food1.info())

# Buat instance class Drink dan tetapkan ke variable drink1
drink1 = Drink('Kopi', 3)

# Tetapkan volume variable drink1 ke 180
drink1.volume = 180

# Panggil method info dari drink1 dan cetak nilai return
print(drink1.info())
Пример #27
0
def act6():

    from food import Food
    from drink import Drink
    from dessert import Dessert

    food1 = Food('Asian Curry Plate (soup and mini desert set)', 1200, 590)
    food2 = Food(' Rice Bowl with Vegetables (soup and mini desert set)', 1200,
                 370)
    food3 = Food('Pizza Toast (soup and mini desert set)', 1000, 310)
    food4 = Food('Vegan Plate (soup and mini dessert set)', 1200, 310)
    food5 = Food('Herb Fragrant Salt Pork Bowl (soup and mini dessert set)',
                 1000, 680)
    food6 = Food('Skip', 0, 0)

    foods = [food1, food2, food3, food4, food5, food6]

    drink1 = Drink('Decaf Coffee', 450, 0)
    drink2 = Drink('Organic Black Tea', 450, 0)
    drink3 = Drink('Morinaga Tea', 500, 0)
    drink4 = Drink('Citrus Unshiu Juice', 450, 35)
    drink5 = Drink('Perrier', 350, 0)
    drink6 = Drink('Skip', 0, 0)

    drinks = [drink1, drink2, drink3, drink4, drink5, drink6]

    dessert1 = Dessert('Pancake with Vegan Butter and Fruits', 880, 105)
    dessert2 = Dessert('Waffles with Soy Milk Whipped Cream and Fruits', 880,
                       180)
    dessert3 = Dessert('Brownie Soy Milk Whipped', 650, 200)
    dessert4 = Dessert('Clafoutis with Shanti Sauce', 700, 250)
    dessert5 = Dessert('Coconut Kudzu Pudding', 650, 140)
    dessert6 = Dessert('Skip', 0, 0)

    desserts = [dessert1, dessert2, dessert3, dessert4, dessert5, dessert6]

    print()
    print('***** FOOD MENU *****')
    index = 0
    for food in foods:
        print(str(index) + '. ' + food.info())
        index += 1

    print()
    print('***** DRINK MENU *****')
    index = 0
    for drink in drinks:
        print(str(index) + '. ' + drink.info())
        index += 1

    print()
    print('***** DESSERT MENU *****')
    index = 0
    for dessert in desserts:
        print(str(index) + '. ' + dessert.info())
        index += 1

#if choose invalid number

    print('--------------------')

    while True:
        food_order = input('Please select a number from the food menu: ')

        if food_order == '0' or food_order == '1' or food_order == '2' or food_order == '3' or food_order == '4' or food_order == '5' or food_order == '6':
            selected_food = foods[int(food_order)]

        else:
            print("Please insert a valid number.")
            print()
            continue

        break

    while True:
        drink_order = input('Please select a number from the drink menu: ')

        if drink_order == '0' or drink_order == '1' or drink_order == '2' or drink_order == '3' or drink_order == '4' or drink_order == '5' or drink_order == '6':
            selected_drink = drinks[int(drink_order)]

        else:
            print("Please insert a valid number.")
            print()
            continue

        break

    while True:
        dessert_order = input('Please select a number from the dessert menu: ')

        if dessert_order == '0' or dessert_order == '1' or dessert_order == '2' or dessert_order == '3' or dessert_order == '4' or dessert_order == '5' or dessert_order == '6':
            selected_dessert = desserts[int(dessert_order)]

        else:
            print("Please insert a valid number.")
            print()
            continue

        break

    count = int(
        input(
            'How many sets would you like to purchase?(10% off when you purchase 3 sets): '
        ))

    result = selected_food.get_total_price(
        count) + selected_drink.get_total_price(
            count) + selected_dessert.get_total_price(count)

    #print total

    print()
    print('----------------------------------------------------------')
    print('Here is your total order:')
    print()
    print(
        str(selected_food.name) + ' ¥' + str(selected_food.price) + ' x ' +
        str(count))
    print(
        str(selected_drink.name) + ' ¥' + str(selected_drink.price) + ' x ' +
        str(count))
    print(
        str(selected_dessert.name) + ' ¥' + str(selected_dessert.price) +
        ' x ' + str(count))

    if count >= 3:
        print('10% discount')

    else:
        print('    ')

    print('----------------------------------------------------------')
    print('Your total is ' + str(result) + ' Yen')
    print()
    print('Thank you for using W-Delivers! We hope to serve you again soon!')
    print('----------------------------------------------------------')
    print()
    print('Your order is on its way')

    import time

    for i in range(100):
        print('.', end='')
        time.sleep(1)
Пример #28
0
 def remove_drink(self, drink_type: Drink):
     self.drink_stocks[drink_type.name] -= 1
     return Drink(drink_type)
Пример #29
0
from food import Food
from drink import Drink

food1 = Food('Roti Lapis', 5, 330)
food2 = Food('Kue Coklat', 4, 450)
food3 = Food('Kue Sus', 2, 180)

foods = [food1, food2, food3]

drink1 = Drink('Kopi', 3, 180)
drink2 = Drink('Jus Jeruk', 2, 350)
drink3 = Drink('Espresso', 3, 30)

drinks = [drink1, drink2, drink3]

print('''Welcome to Python Cafe
      ''')

print('Makanan')
index = 0
for food in foods:
    print(str(index) + '. ' + food.info())
    index += 1

print('Minuman')
index = 0
for drink in drinks:
    print(str(index) + '. ' + drink.info())
    index += 1

print('--------------------')
Пример #30
0
# Import the Food class and Drink class
from food import Food
from drink import Drink

# Create an instance of the Food class and assign it to the food1 variable
food1 = Food('Sandwich', 5)

# Call the info method from food1 and output the return value
print(food1.info())

# Create an instance of the Drink class and assign it to the drink1 variable
drink1 = Drink('Coffee', 3)

# Call the info method from drink1 and output the return value

print(drink1.info())
Пример #31
0
from drink import Drink
from food import Food

food1 = Food('Sandwich', 5, 330)
print(food1.info())
drink1 = Drink('Coffee', 3)
drink1.volume = 180
print(drink1.info())