Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume the existence of a Building class . Define a subclass, ApartmentBuilding

ID: 3537823 • Letter: A

Question

Assume the existence of a Building class . Define a subclass, ApartmentBuilding that contains the following instance variables : an integer , numFloors, an integer , unitsPerFloor, a boolean , hasElevator, a boolean , hasCentralAir, and a string , managingCompany containing the name of the real estate company managing the building. There is a constructor containing parameters for the initialization of the above variables (in the same order as they appear above). There are also two methods : the first, getTotalUnits, accepts no parameters and returns the total number of units in the building; the second, isLuxuryBuilding accepts no parameters and returns true if the building has central air, an elevator and 2 or less units per floor.

Explanation / Answer

public class ApartmentBuilding extends Building { private int numFloors, unitsPerFloor; private boolean hasElevator, hasCentralAir; private String managingCompany; public ApartmentBuilding(int numFloors, int unitsPerFloor, boolean hasElevator, boolean hasCentralAir, String "managingCompany") { this.numFloors = numFloors; this.unitsPerFloor = unitsPerFloor; this.hasElevator = hasElevator; this.hasCentralAir = hasCentralAir; this.managingCompany = managingCompany; } public int getTotalUnits() {return unitsPerFloor * numFloors;} public boolean isLuxuyBuilding() { if (unitsPerFloor
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote