def add_non_furniture_nor_appliance(itemcode, itemdescription, itemprice, itemrentalprice): """This function adds an item that's neither furniture nor an applicance """ newitem = Inventory(itemcode, itemdescription, itemprice, itemrentalprice) FULLINVENTORY[itemcode] = newitem.returnasdictionary()
def setUp(self): self.Inventory=Inventory() self.item1 = Item('Sky Kraken Beer, 6-pack', 1, 9.99, 2.00,True) self.item2 = Item('Pepperidge Farm Goldfish Crackers, 16oz', 2, 3.99, .5, False) self.item3 = Item('Signature 9 Grain Bread, Loaf', 3, 2.99, 1.2, False) self.item4 = Item('Ben & Jerrys Ice Cream, Pint', 4, 4.59, 1.3, False) self.Inventory.itemlist=[self.item1, self.item2, self.item3, self.item4]
def return_as_dictionary(self): """ Function that return dictionary object for applicances. """ outputdict = {} outputdict = Inventory.return_as_dictionary(self) outputdict['brand'] = self.brand outputdict['voltage'] = self.voltage return outputdict
def return_as_dictionary(self): """ Function that return dictionary object for furniure. """ outputdict = {} outputdict = Inventory.return_as_dictionary(self) outputdict['material'] = self.material outputdict['size'] = self.size return outputdict
def main(): #create items item1 = Item('Sky Kraken Beer, 6-pack', 1, 9.99, 2.00,True) item2 = Item('Pepperidge Farm Goldfish Crackers, 16oz', 2, 3.99, .5, False) item3 = Item('Signature 9 Grain Bread, Loaf', 3, 2.99, 1.2, False) item4 = Item('Ben & Jerrys Ice Cream, Pint', 4, 4.59, 1.3, False) #add items to inventory inventory = Inventory() inventory.addItem(item1) inventory.addItem(item2) inventory.addItem(item3) inventory.addItem(item4) # ?kiosk creates Transaction? Kiosk.startTransaction(1) #add items to TransactionList Transaction.addTransactionItem(item1) # Restricted=True-->? Transaction.addTransactionItem(item2) Transaction.addTransactionItem(item3) Transaction.addTransactionItem(item4) # I cann't get the items to add to the transactionItemList. I have tried # various versions of parameters, and nothing works. I'm out of ideas. #do receipt/total calc saleTotal = Transaction.calcTotal() receipt = Transaction print(receipt) print(saleTotal)
def __init__(self, brand, voltage, *args): # Creates common instance variables from the parent class Inventory.__init__(self, *args) self.brand = brand self.voltage = voltage
def __init__(self, material, size, *args): # Creates common instance variables from the parent class Inventory.__init__(self, *args) self.material = material self.size = size