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:
- (int) number of rooms
- (int) number of bathrooms
- booleanis it occupied.
- (string) address
(you will have to create the actual variables names.)
Then create two subclasses which extend the class House.
- rental. A rental house has the following attributes:
- (int) rent
- (boolean) is rented
- owned. An owned house has the following attributes:
- (int) mortgage
- (int) insurance
- (boolean) is paid in full : a house paid in full has a mortgage of 0.
For all the classes:
- create the constructors, the mutators, the accessors for all the attributes.
- You should have at least one constructor which is not a default constructor.
- 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
Get step-by-step solutions from verified subject matter experts
