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 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 setUp(self): self.Transaction=Transaction(1) self.transactionItem1 = Item('Sky Kraken Beer, 6-pack', 1, 9.99, 2.00,True) self.transactionItem2 = Item('Pepperidge Farm Goldfish Crackers, 16oz', 2, 3.99, .5, False) self.transactionItem3 = Item('Signature 9 Grain Bread, Loaf', 3, 2.99, 1.2, False) self.transactionItem4 = Item('Ben & Jerrys Ice Cream, Pint', 4, 4.59, 1.3, False) self.Transaction.transactionItemList=[self.transactionItem1, self.transactionItem2, self.transactionItem3, self.transactionItem4] self.user=User('101', 'Mike', 'Gilson', '*****@*****.**', '2065551212')
def addItems(self, items, fromuser, message, line=0): for item in items: if len(self.items) + sum([len(x.subitems) for x in self.items]) < 20: self.items.append( Item.new(self.id, item, fromuser, message, line)) line += 1 else: raise StopIteration("Too many items")
def __init__(self, id="", name="", owner=0, ownername=""): self.coworkers = [] self.items = [] if name and owner and ownername: self.id = id self.name = name self.owner = User(owner, ownername) else: listdetails = getList(id) if listdetails: self.id = listdetails[0] self.name = listdetails[1] self.owner = User(listdetails[2], listdetails[3]) coworkers = getCoworkers(self.id) for coworker in coworkers: self.coworkers.append(User(coworker[1], coworker[2])) items = getItems(self.id) for item in items: self.items.append(Item(item[0], item[2], item[3])) else: raise KeyError(_("notexisting"))
def setUp(self): self.item=Item('Sky Kraken Beer, 6-pack', 1, 9.99, 2.00, True)
def setUp(self): self.staff=Staff(10, 'Colin', 'Hanson', '*****@*****.**',2065551212, 'CH123', 'cheesewizard1234') self.Item= Item('Sky Kraken Beer, 6-pack', 1, 9.99, 2.00, True)
def worker(element): print(element) workerHtmlTree = BeautifulSoup(requests.get(element).text, "lxml") return Item(**Item.populateObjectFromHTML(workerHtmlTree, element))
def getItemInfo(self, Item): return Item.getName(self), Item.getNumber(self), Item.getPrice( self), Item.getWeight(self), Item.getRestricted(self)