Skip to content

Instantly share code, notes, and snippets.

@ranraj
Last active August 14, 2020 14:11
Show Gist options
  • Save ranraj/dc0dd5c219e63a563266b6599e5b81b0 to your computer and use it in GitHub Desktop.
Save ranraj/dc0dd5c219e63a563266b6599e5b81b0 to your computer and use it in GitHub Desktop.
programming language session

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())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment