Question: In Java prepare class for House. This class will contain 4 attributes: (int) number of rooms (int) number of bathrooms booleanis it occupied. (string) address

In Java prepare class for House. This class will contain 4 attributes:

  1. (int) number of rooms
  2. (int) number of bathrooms
  3. booleanis it occupied.
  4. (string) address

(you will have to create the actual variables names.)

Then create two subclasses which extend the class House.

  1. rental. A rental house has the following attributes:
  2. (int) rent
  3. (boolean) is rented
  4. owned. An owned house has the following attributes:
  5. (int) mortgage
  6. (int) insurance
  7. (boolean) is paid in full : a house paid in full has a mortgage of 0.

For all the classes:

  1. create the constructors, the mutators, the accessors for all the attributes.
  2. You should have at least one constructor which is not a default constructor.
  3. Create the driver, and 3 objects: one house, one rental and one owned house. Your driver should create the objects, fill them and display the information for the houses.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!