Order Domain
class Order:
def __init__(self,count,deliveryAddress,phonenumber,landmark1,buyerName,specialNotes,status):
self.count = count
self.deliveryAddress = deliveryAddress
self.phonenumber = phonenumber
self.landmark1 = landmark1
self.buyerName = buyerName
self.specialNotes = specialNotes
self.status = status
def processOrder(order):
if order.count > 15:
print("Limit exceeded")
else:
print(order.count,"Burger","+ Toping")
print("delivered to ",order.deliveryAddress)
print("phonenumber: ",order.phonenumber)
burgerOrder = Order(10121123123123122176,"cdm",230,"mainroad","ran","","ordered")
processOrder(burgerOrder)
Book Domain
class Book:
def __init__(self,index,page):
self.index = index
self.page = page
def read(self):
txt = "Index : {index}, Page : {number:.2f}"
return txt.format(number = page.get_number(),index = index.get_content())
class Page:
def __init__(self,number):
self.number = number
def get_number(self):
return self.number
class Index:
def __init__(self,content):
self.content = content
def get_content(self):
return self.content
index = Index("Holly")
page = Page(10121123123123123123)
book = Book(index,page)
print(book.read())
No comments:
Post a Comment