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)
class OrderTest(unittest.TestCase): 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) def test_addandGetOrderItems(self): self.oitems = self.o.getOrderItems() self.assertEqual(len(self.oitems), 4) def test_CalculateTotal(self): payment = self.o.calcTotal() self.assertEqual(str(payment), 'Your payment today will be 22.0')
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 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)
class OrderTest(unittest.TestCase): 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) def test_CalculateTotal(self): payment = self.order.calcTotal() self.assertEqual(str(payment), 'Your payment today will be 17.0')
def main(): selection1 = Menu(1, 'Grilled Salmon', 11.20) selection2 = Menu(2, 'Frensh Fries', 5.00) selection3 = Menu(3, 'Coke', 2.00) orderdetail1 = OrderDetail(selection1, 1) orderdetail2 = OrderDetail(selection2, 2) orderdetail3 = OrderDetail(selection3, 1) order = Order() order.addOrderItems(orderdetail1) order.addOrderItems(orderdetail2) order.addOrderItems(orderdetail3) payment = order.calcTotal() print(payment)
class OrderTest(unittest.TestCase): 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 test_CalculateTotal(self): payment=self.o.calcTotal() self.assertEqual(str(payment), 'Your payment today will be 27.0')
class OrderTest(unittest.TestCase): 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 test_addandGetOrderItems(self): self.oitems=self.o.getOrderItems() self.assertEqual(len(self.oitems), 2) def test_CalculateTotal(self): payment=self.o.calcTotal() self.assertEqual(str(payment), 'Your total is 14.5')
class OrderTest(unittest.TestCase): def setUp(self): self.o=Order() self.menuitem1=Menu(3,'cheese stick', 2.10) self.menuitem2=Menu(42,'dessert', 10.00) self.orderitem1=OrderDetail(self.menuitem1,1) self.orderitem2=OrderDetail(self.menuitem2,3) #self.orderitem3=OrderDetail(self.menuitem3,2) self.o.addOrderItems(self.orderitem1) self.o.addOrderItems(self.orderitem2) #self.o.addOrderItems(self.orderitem3) #not passed def test_CalculateTotal(self): payment=self.o.calcTotal() self.assertEqual(str(payment), 'Payment Amount: 32.1')
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 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)
class OrderTest(unittest.TestCase): 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 test_getOrderItems(self): self.oitems=self.o.getOrderItems() self.assertEqual(len(self.oitems),3) def test_calculateSubTotal(self): subtotal=self.o.calculateSubTotal() self.assertEqual(str(subtotal), '23.0')
class OrderTest(unittest.TestCase): 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 test_addandGetOrderItems(self): self.oitems = self.o.getOrderItems() self.assertEqual(len(self.oitems), 3) def test_CalculateTotal(self): payment = self.o.calcTotal() self.assertEqual(str(payment), 'Your payment today will be 23.0')