Пример #1
0
def BuildAPizza():
    pizzAmount = DeterminePizzaAmount()
    pickedToppings = []
    for i in range(0, pizzAmount):
        pickedToppings.append(toppings.GetValidTopping(pickedToppings))

    pizzaOrder = pizza.Pizza(random.choice(crust.sizes), pickedToppings,
                             DetermineOrderQuantity(),
                             random.choice(crust.crusts))
    return pizzaOrder
Пример #2
0
def order():
    print("MENU:")
    incomplete = True
    obj = None
    while incomplete:
        print("Select from the following stuffings: ")
        for index, choice in enumerate(menu, 1):
            print(f"{index}: {choice}")
        try:
            item = int(input())
            item = menu[item - 1]
            if item == burger.NAME:
                obj = burger.Burger()
            elif item == pizza.NAME:
                obj = pizza.Pizza()
            obj.create_item()
            print(obj)
            incomplete = False
        except (ValueError, IndexError):
            print("Invalid input please try again")
 def create_pizza(self, ingredients_factory):
     pizza_created = pizza.Pizza(ingredients_factory)
     return pizza_created
Пример #4
0
def OrderingSystem():
    ## customer_order will be storing the objects of the pizza order

    #stores order details
    customer_order = []
    #stores prices of order elements
    total_price = []

    location = ["london", "newcastle", "bath", "liverpool", "kent"]
    orderNumber = 0

    while True:
        pizza_name = input("what pizza would you like?")
        pizza_choices = {
            "margherita": 10.00,
            "pepperoni": 11.00,
            "hawaiian": 10.00,
            "meat feast": 12.00,
            "bbq chicken": 13.00
        }

        if pizza_name in pizza_choices:
            print(pizza_name, "exists")
            # prints cost of selected topping
            print("this will cost you £", pizza_choices[pizza_name])
            total_price.append(pizza_choices[pizza_name])
            print(total_price)
            break

        # if inputted base does not exist
        elif pizza_name not in pizza_choices:
            print(pizza_name, "is not on offer")

    while True:
        pizza_type = input("what pizza type would you like?")
        pizza_types = {
            "deep dish": 4.00,
            "sicilian": 5.00,
            "greek": 6.00,
            "calzone": 7.00,
            "neapolitan": 8.00,
            "new york style": 9.00
        }

        if pizza_type in pizza_types:
            print(pizza_type, "exists")
            # prints cost of selected pizza type
            print("this will cost you £", pizza_types[pizza_type])
            total_price.append(pizza_types[pizza_type])
            print(total_price)
            break

        elif pizza_type not in pizza_types:
            print(pizza_type, "is not on offer")

        new_pizza = pizza.Pizza(pizza_name, pizza_type)

        customer_order.append(new_pizza)

    while True:

        pizza_topping = input("what pizza topping would you like?")
        toppings = {"cheese": 0.86, "sausage": 0.90, "ham": 1.0}
        if pizza_topping in toppings:
            print(pizza_topping, "exists")
            #prints cost of selected topping
            print("this will cost you £", toppings[pizza_topping])
            total_price.append(toppings[pizza_topping])
            print(total_price)
            new_topping = topping.Topping(pizza_topping)
            customer_order.append(new_topping)
            break

# if inputted topping does not exist
        elif pizza_topping not in toppings:
            print(pizza_topping, "is not on offer")

    while True:
        print("base choices are small, medium or large")
        pizza_base = input("what size pizza base would you like?")

        base_selection = {"small": 5, "medium": 6, "large": 7}

        if pizza_base in base_selection:
            print(pizza_base, "exists")
            # prints cost of selected topping
            print("this will cost you £", base_selection[pizza_base])
            total_price.append(base_selection[pizza_base])
            print(total_price)

            # new base object initialised
            new_base = base.Base(pizza_base)
            customer_order.append(new_base)
            break

        # if inputted base does not exist
        elif pizza_base not in base_selection:
            print(pizza_base, "is not on offer")

    customer_location = input("which branch would you like to order from: ")

    while customer_location not in location:
        if customer_location in location:
            print("location exists")
            new_branch = branch.Branch(customer_location)
            customer_order.append(new_branch)
            break

        else:
            print("location does not exist")
            print(location)
            customer_location = input(
                "which branch would you like to order from: ")

    orderNumber = orderNumber + 1

    customer_order.append(orderNumber)

    print("Order Summary")
    print(customer_order)
    #add dictionary for total prices of items on the customers order
    placed = "order placed"
    not_placed = "order not placed"

    print("the total cost of your order is: £", sum(total_price))

    place_order = input("would you like to place your order: ")

    if place_order == "yes":
        print(bool(placed))
        customer_order.clear()
        total_price.clear()
        main()
    elif place_order == "no":
        print(bool(not_placed))
        customer_order.clear()
        total_price.clear()
        main()
Пример #5
0
 def test_pizza_anit_Except(self):
     with self.assertRaises(TypeError):
         pizza.Pizza(2)
Пример #6
0
 def setUp(self):
     self.pizza = pizza.Pizza(pizza.PIZZA_SMALL_SIZE)
Пример #7
0
metadata_inputs = lines[0][:-1].split(' ')

metadata['rows'] = int(metadata_inputs[0])
metadata['columns'] = int(metadata_inputs[1])
metadata['min_ingredient_per_slice'] = int(metadata_inputs[2])
metadata['max_cells_per_slice'] = int(metadata_inputs[3])

pizza_list = list()

for i in range(1, len(lines)):
    pizza_row = list()
    for j in range(len(lines[i]) - 1):
        pizza_row.append(lines[i][j])
    pizza_list.append(pizza_row)

pizza = pizza.Pizza(pizza_list)

#print(pizza)

min_cells = metadata['max_cells_per_slice'] if metadata['columns'] > metadata[
    'max_cells_per_slice'] else metadata['columns']

column_slices = {}
potential_column_scores = {}

column = 0

while column < metadata['columns']:
    potential_column_scores[column] = 0
    column_slices[column] = []
    row = 0
Пример #8
0
import chips
import pizza
import personalpizza
import shop

my_shop = shop.Shop()

personalpizza1 = personalpizza.Personal_pizza("Personal_pizza1", 40, 6, "Corn")
personalpizza2 = personalpizza.Personal_pizza("Personal_pizza2", 30, 4,
                                              "Olives")
pizza1 = pizza.Pizza("Pizza1", 35, 8)
pizza2 = pizza.Pizza("Pizza2", 20, 8)
chips1 = chips.Chips("Chips1", 40, False)
chips2 = chips.Chips("Chips2", 12, True)

my_shop.add_product(personalpizza1)
my_shop.add_product(personalpizza2)
my_shop.add_products(pizza1, pizza2, chips1, chips2)

print("---------------Before orders-------------------------")
print(my_shop.get_info())

print("---------------Chips1 order-------------------------")
print(my_shop.order_product("Chips1"))
print(my_shop.get_info())

print("---------------Pizza1 order-------------------------")
print(my_shop.order_product("Pizza1"))
print(my_shop.get_info())
"""
OUTPUT: