Use Java Code to this Please keep it simple 1. Create House Class with the following properties and methods Properties: a. floorSize b. noOfFloors c. noOfDoors Methods: d. switchOn()(print something here to indicate switching on) e. lightOpen()(print something here to indicate light is open) f. ovenOpen() (print something here to indicate oven is open) 2. Create TownHouse Class inherit the House class a. Create a main function b. In TownHouse modify the value of the following properties (noOfFloors and noOfDoors) (you may use static value) Inside main function: 3. Instantiate the TownHouse Class once (create an object with TownHouse type) 4. Display all the properties/attributes 5. Calling the switchOn() will automatically execute lightOpen() and ovenOpen() 6. Call switchOn() function.
Use Java Code to this
Please keep it simple
1. Create House Class with the following properties and methods
Properties:
a. floorSize
b. noOfFloors
c. noOfDoors
Methods:
d. switchOn()(print something here to indicate switching on)
e. lightOpen()(print something here to indicate light is open)
f. ovenOpen() (print something here to indicate oven is open)
2. Create TownHouse Class inherit the House class
a. Create a main function
b. In TownHouse modify the value of the following properties (noOfFloors and noOfDoors) (you may use static value)
Inside main function:
3. Instantiate the TownHouse Class once (create an object with TownHouse type)
4. Display all the properties/attributes
5. Calling the switchOn() will automatically execute lightOpen() and ovenOpen()
6. Call switchOn() function.
Note: You may create separate file for each class.
Step by step
Solved in 2 steps with 2 images