Error 1. Create House Class with the following properties and methods a.floorSize b. noOfFloors c. noOfDoors d.switchOn() e.lightOpen() f.ovenOpen() 2. Create TownHouse Class inherit the House class 3. Modify the value of the following(noOfFloors and noOfDoors) 4. Instantiate the TownHouse Class once 5. Display all the properties 6. Calling the switchOn() will automatically execute lightOpen() and ovenOpen()
Error
1. Create House Class with the following properties and methods
a.floorSize
b. noOfFloors
c. noOfDoors
d.switchOn()
e.lightOpen()
f.ovenOpen()
2. Create TownHouse Class inherit the House class
3. Modify the value of the following(noOfFloors and noOfDoors)
4. Instantiate the TownHouse Class once
5. Display all the properties
6. Calling the switchOn() will automatically execute lightOpen() and ovenOpen()
class House:
def __init__(self, floorSize, noOfFloors, noOfDoors):
self.floorSize = floorSize
self.noOfFloors = noOfFloors
self.noOfDoors = noOfDoors
def switchOn(self):
# statements
print("Switch ON")
self.lightOpen()
self.ovenOpen()
def lightOpen(self):
print("Light Open")
def ovenOpen(self):
print("Oven Open")
class TownHouse(House):
def __init__(self, floorSize, noOfFloors, noOfDoors):
super().__init__(self, floorSize, noOfFloors, noOfDoors)
print(f"House Floor Size: {floorSize}")
print(f"House Number of Floors: {noOfFloors}")
print(f"House Number of Doors: {noOfDoors}")
t = TownHouse(150, 4, 8)
t.switchOn()
Step by step
Solved in 2 steps