Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions