SKP Hotel offers accommodation, meals facilities.

Create a class Accommodation with Room Number, type of room, and rent, etc..

Create a class meals services includes: meals code, name, price, etc..

Create a class customer with customer number, name, address, etc.

Customer class is derived by using Accommodation and meals classes.


Share with your friends
Call

class Accommodation(object):

# constructor to create an object

def_init_(self):

self.roomno=0

self.roomtype=”

self.roomrent=0.0

defgetroom(self):

self.roomno=input(“Enter the Room no:”)

self.roomtype=rawjnput(“Enter the Room type:’)

self.roomrent=float(raw_input(“Enter Room Rent”))

class Meals(object):

# Meals class

def_init_(self):

self.mealcode=0

self.mealname=“”

self.mealprice=0.0

def getmeals(self):

self.mealcode=input(“Enter the meal code:”)

self.mealname=raw_input(“Enter the meal name:”)

self.mealprice=float(raw_input(“Enter the meal price”))

class Customer(Accommodation,Meals):

def_init_(self):

super(Customer,self)._init_()

self.custnum=0

self.custname=‘ ’

self.address=‘ ’

def getCustomer(self):

self.custnum=input(“Enter the customer number”)

self.custname=raw_input(“Enter customer name”)

self. address=raw _input(“Enter customer address”)

def displaybill(self):

print“Customer Name:”,

self.custname,“Address:”, self, address

print“Room No:”,

self.roomno,“Room Type:”,

self.roomtype,“Room Rent: Rs’jself.roomrent

print“Meal Name:”,

self.mealname,“Price:”,

self.mealprice

print“Total Amount Due:”,

self.roomrent+ self.mealprice

obj=Customer()

obj.getCustomer()

obj.getroom()

obj.getmeals()

obj.displaybill()

Talk Doctor Online in Bissoy App