Apartment Class

(Overriding methods continued)

This class builds on what you did in your House class. You will use super() in Apartment's constructor, but you also want to know which story your Apartment is on, so you will give Apartment a private int instance variable for story. You will make int story a constructor input so you can set your Apartment's story when you make your Apartment object. You set this.story in the constructor as you would normally after calling super().

Your apartment will have 4 rooms, 4 walls, and may or may not have a washer.

The Property Value now depends on whether or not the apartment has a washer. If the apartment has a washer, the property value goes up by 100.

In addition to the more complex constructor and new instance variable, you will make a method to return the story on which your apartment exists.

We will also have a toString() method that will display the story in addition to property value and number of windows.

For displaying the property value and number of rooms use super to invoke the toString() from Residence class:

super.toString();