class ProductCatalog(object): @staticmethod def lookupDesc(itemID) : pass # probably some database query @staticmethod def lookupPrice(itemID) : pass # probably some database query class Product(object): def __init__(self, itemID): self.itemID = itemID self.description = ProductCatalog.lookupDesc(itemID) self.price = ProductCatalog.lookupPrice(itemID) def getPrice(self) return self.price class OrderLine(object): def __init__(self, productID, quantity): self.product = Product(productID) self.quantity = quantity def getPriceTotal(self): return (self.product.getPrice() * self.quantity) class Sale(object): def __init__(self): self.LineItems =[] self.SaleTotal = 0 def addLineItem(self,product,quantity): ol = Orderline(product,quantity): self.LineItems.append((oi.product,oi.quantity,oi.getPriceTotal())) def get LineItem(self, num): return self.LineItems[num] def getSaleTotal(self): self.SaleTotal = 0 for order in self.LineItems: self.Total = self.Total + order[2]