def main(): item1 = Item(1, 'medium fries', 4.00) item2 = Item(2, 'chicken nuggets', 5.50) item3 = Item(3, 'large coke', 2.25) orderitem1 = OrderItem(item1, 2) orderitem2 = OrderItem(item2, 4) orderitem3 = OrderItem(item3, 2) order = Order() order.addOrderItems(orderitem1) order.addOrderItems(orderitem2) order.addOrderItems(orderitem3) print("Here's your order summary: ") print(item1) print(item2) print(item3) subTotal = order.calculateSubTotal() tax = order.calculateTax() total = order.calculateTotal() print("Subtotal $" + subTotal) print("Tax $" + tax) print("Your total is $" + total)
def menu(): item1 = Item(1, 'fries', 2.25) item2 = Item(2, 'cheese burger', 5.00) item3 = Item(3, 'chicken burger', 5.25) item4 = Item(4, 'milk shike', 4.00) inventory = Inventory() inventory.addItem(item1) inventory.addItem(item2) inventory.addItem(item3) inventory.addItem(item4) orderitem1 = OrderItem(inventory.getItemByNumber(1), 1) orderitem2 = OrderItem(inventory.getItemByNumber(2), 2) orderitem3 = OrderItem(inventory.getItemByNumber(3), 1) orderitem4 = OrderItem(inventory.getItemByNumber(4), 4) order = Order() order.addOrderItems(orderitem1) order.addOrderItems(orderitem2) order.addOrderItems(orderitem3) order.addOrderItems(orderitem4) payment = order.calcTotal() print(payment)
def setUp(self): self.o=Order() self.item1=MenuItem(1,'cheeseburguer', 6.00) self.item2=MenuItem(2,'french fries', 2.50) self.orderitem1=OrderItem(1, 2, 6.00) self.orderitem2=OrderItem(2, 1, 2.50) self.o.addOrderItems(self.orderitem1) self.o.addOrderItems(self.orderitem2)
def setUp(self): self.item1 = Item(1, 'beer', 6.25) self.item2 = Item(2, 'chips', 4.50) self.orderitem1 = OrderItem(self.item1, 2) self.orderitem2 = OrderItem(self.item2, 1) self.order = Order() self.order.addOrderItems(self.orderitem1) self.order.addOrderItems(self.orderitem2)
class OrderItemTest(unittest.TestCase): def setUp(self): self.item = Item(1, 'item1', 30.00) self.oitem = OrderItem(self.item, 2) def test_Quantity(self): self.assertEqual(self.oitem.getQuantity(), 2) def test_item(self): item = self.oitem.getItem() self.assertEqual(str(item), 'item1')
def setUp(self): self.o=Order() self.item1=Item(1,'spicy chicken sandwich meal', 10.00) self.item2=Item(2,'sundae', 3.00) self.item3=Item(3,'apple pie', 2.00) self.orderitem1=OrderItem(self.item1,1) self.orderitem2=OrderItem(self.item2,3) self.orderitem3=OrderItem(self.item3,2) self.o.addOrderItems(self.orderitem1) self.o.addOrderItems(self.orderitem2) self.o.addOrderItems(self.orderitem3)
def setUp(self): self.o=Order() self.item1=Item(1,'chips', 4.00, 'med') self.item2=Item(2,'pizza', 13.00, 'small') self.item3=Item(3,'fries', 2.00, 'small') self.orderitem1=OrderItem(self.item1,2,'none') self.orderitem2=OrderItem(self.item2,1,'none') self.orderitem3=OrderItem(self.item3,3,'none') self.o.addOrderItems(self.orderitem1) self.o.addOrderItems(self.orderitem2) self.o.addOrderItems(self.orderitem3)
def setUp(self): self.o = Order() self.item1 = Item(1, 'beer', 10.00) self.item2 = Item(2, 'chips', 3.00) self.item3 = Item(3, 'salsa', 2.00) self.orderitem1 = OrderItem(self.item1, 1) self.orderitem2 = OrderItem(self.item2, 3) self.orderitem3 = OrderItem(self.item3, 2) self.o.addOrderItems(self.orderitem1) self.o.addOrderItems(self.orderitem2) self.o.addOrderItems(self.orderitem3)
def main(): item1 = Item(1, 'chips', 2.50, 'med') item2 = Item(2, 'pizza', 15.99, 'large') orderitem1 = OrderItem(item1, 1, 'none') orderitem2 = OrderItem(item2, 1, 'olives') order = Order() order.addOrderItems(orderitem1) order.addOrderItems(orderitem2) payment = order.calcTotal() print(payment)
def setUp(self): self.o = Order() self.item1 = Item(1, 'fries', 10.00) self.item2 = Item(2, 'cheese burger', 3.00) self.item3 = Item(3, 'chicken burger', 2.00) self.item4 = Item(4, 'milk shike', 2.00) self.orderitem1 = OrderItem(self.item1, 1) self.orderitem2 = OrderItem(self.item2, 3) self.orderitem3 = OrderItem(self.item3, 2) self.orderitem4 = OrderItem(self.item4, 2) self.o.addOrderItems(self.orderitem1) self.o.addOrderItems(self.orderitem2) self.o.addOrderItems(self.orderitem3) self.o.addOrderItems(self.orderitem4)
class OrderItemTest(unittest.TestCase): def setUp(self): self.orderitem1=OrderItem('drink', 2, 2.00) self.orderitem2=OrderItem('cheeseburguer', 3, 4.00) def test_MenuItem(self): self.assertEqual(str(self.orderitem1), 'drink') self.assertEqual(str(self.orderitem2), 'cheeseburguer') def test_Quantity(self): self.assertEqual(str(self.orderitem1.getQuantity()), '2') self.assertEqual(str(self.orderitem2.getQuantity()), '3') def test_ItemPrice(self): self.assertEqual(str(self.orderitem1.getItemPrice()), '2.0') self.assertEqual(str(self.orderitem2.getItemPrice()), '4.0')
def collectData(self): id_ = None approved = self._notApproved approved_by = self._approver date_ = datetime.datetime.now().date() if self._currentItem is not None: id_ = self._currentItem.item_id approved = self._currentItem.item_approved approved_by = self._currentItem.item_approved_by date_ = self._currentItem.item_date self._newItem = OrderItem( id_=id_, name=self.ui.textDescript.toPlainText(), descript=self.ui.textReason.toPlainText(), qty=self.ui.spinQuantity.value(), date_receive=datetime.datetime.strptime( self.ui.dateReceive.date().toString("yyyy-MM-dd"), "%Y-%m-%d").date(), priority=self.ui.comboPriority.currentData(const.RoleNodeId), user=self.ui.comboUser.currentData(const.RoleNodeId), approved=approved, approved_by=approved_by, cost=int(self.ui.spinCost.value() * 100), document=self.ui.editDocument.text(), date=date_)
class OrderItemTest(unittest.TestCase): def setUp(self): self.item = Item(1, 'cheese burger', 2.75) self.quantity = 2 self.orderitem = OrderItem(self.item, self.quantity) def test_getItem(self): self.item = self.orderitem.getItem() self.assertEqual(str(self.item), 'cheese burger') def test_getItemPriceFromOrderItem(self): self.item = self.orderitem.getItem() self.assertEqual(self.item.getItemPrice(), 2.75) def test_getQuantity(self): self.assertEqual(self.orderitem.getQuantity(), 2)
class OrderItemTest(unittest.TestCase): def setUp(self): self.item=Item(1,'chips',3.75, 'med') self.quantity=2 self.special='none' self.orderitem=OrderItem(self.item, self.quantity, self.special) def test_getQuantity(self): self.assertEqual(self.orderitem.getQuantity(),2)
def main(): item1 = Item(1, 'burger', 4) item2 = Item(2, 'coke', 3) item3 = Item(3, 'chicken nuggets', 4) OrderItem1 = OrderItem(item1, 2) OrderItem2 = OrderItem(item2, 1) OrderItem3 = OrderItem(item3, 5) Order = Order() order.addOrderItems(OrderItem1) order.addOrderItems(OrderItem2) order.addOrderItems(OrderItem3) totalCost = Order.calculateTotal() print("Total is: $" + totalCost) main()
def main(): item1 = Item(1, 'soap', 2.25) item2 = Item(2, 'cookies', 5.00) item3 = Item(3, 'milk', 2.25) inventory = Inventory() inventory.addItem(item1) inventory.addItem(item2) inventory.addItem(item3) orderitem1 = OrderItem(inventory.getItemByNumber(1), 1) orderitem2 = OrderItem(inventory.getItemByNumber(2), 2) orderitem3 = OrderItem(inventory.getItemByNumber(3), 1) order = Order() order.addOrderItems(orderitem1) order.addOrderItems(orderitem2) order.addOrderItems(orderitem3) payment = order.calcTotal() print(payment)
def addOrderItem(self, newItem: OrderItem): print('domain model add order item call:', newItem) newId = self._persistenceFacade.insertOrderItem(newItem) newItem.item_id = newId # newItem.item_id = 1000 self._orderData.append(newItem) row = len(self._orderData) - 1 self.orderItemsInserted.emit(row, row) return row
def main(): item1 = Item(1, 'beer', 10.00) item2 = Item(2, 'chips', 3.00) item3 = Item(3, 'salsa', 2.00) inventory = Inventory() inventory.addItem(item1) inventory.addItem(item2) inventory.addItem(item3) orderitem1 = OrderItem(inventory.getItemByNumber(1), 1) orderitem2 = OrderItem(inventory.getItemByNumber(2), 3) orderitem3 = OrderItem(inventory.getItemByNumber(3), 2) order = Order() order.addOrderItems(orderitem1) order.addOrderItems(orderitem2) order.addOrderItems(orderitem3) payment = order.calcTotal() print(payment)
def mcchicken_sandwich(quantity:int=1): return OrderItem(1472, quantity)
def pickles(quantity:int=1): return OrderItem(7617, quantity)
def setUp(self): self.orderitem1=OrderItem('drink', 2, 2.00) self.orderitem2=OrderItem('cheeseburguer', 3, 4.00)
def mustard(quantity:int=1): return OrderItem(7888, quantity)
def meal_constructor(main:OrderItem, side:OrderItem, drink:OrderItem, large:bool=True): ''' Compiles your three items into a meal ''' # Get the meal code meal_codes = { 1427: (0, 6214), # 3 Selects 1472: (0, 6111), # McChicken Sandwich, large 1060: (6020, 0), # Quarter Pounder, regular }.get(main.product_code) # Get the meal code meal_code = meal_codes[{True: 1, False: 0}[large]] # Construct the meal meal = OrderItem(meal_code) meal.add_component(main) # Make the side side_choice = MealChoice(10000011) new_side_code = { 'LARGE_FRIES': 4834, # Large fries 'REGULAR_FRIES': 4833, # Regular fries }.get(side.product_code) side = OrderItem(new_side_code, side.quantity) side_choice.add_choice_solution(side) meal.add_choice(side_choice) # Add the drink drink_choice = MealChoice(10000008) # Drink menu sub_menu_hack = OrderItem(0) soft_drink_menu = MealChoice(9021) # Soft drink sub-menu new_drink_code = { 3010: 3030, # Large Coke 'LARGE_DIET': 3080, # Large Diet Coke 'REGULAR_ZERO': 3175, # Regular Coke Zero }.get(drink.product_code) drink = OrderItem(new_drink_code, drink.quantity) soft_drink_menu.add_choice_solution(drink) sub_menu_hack.add_choice(soft_drink_menu) drink_choice.add_choice_solution(sub_menu_hack) meal.add_choice(drink_choice) return meal
def three_chicken_selects(quantity:int=1): return OrderItem(1427, quantity)
def setUp(self): self.item = Item(1, 'cheese burger', 2.75) self.quantity = 2 self.orderitem = OrderItem(self.item, self.quantity)
def quarter_pounder(quantity:int=1): return OrderItem(1060, quantity)
def ice(quantity:int=1): return OrderItem(90080440, quantity)
def lettuce(quantity:int=1): return OrderItem(7979, quantity)
def mayo(quantity:int=1): return OrderItem(7619, quantity)
def large_coke(quantity:int=1): return OrderItem(3010, quantity)