Create TownHouse Class inherit the House class

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 12PE
icon
Related questions
Question

Use Java Code to create this:

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.

Expert Solution
steps

Step by step

Solved in 8 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,