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

Suppose you create a new PricedApt class that is derived from the RentalApt clas

ID: 663933 • Letter: S

Question

Suppose you create a new PricedApt class that is derived from the RentalApt class (so it's derived from a derived class). It adds one new double attribute, price, which tells what the monthly rental for the apartment is. Here is a constructor call for the class:

PricedApt p = new PricedApt("jill", 900, true, "jack", 1050.00);

The class is missing its constructor. In the box provided below, write this missing piece in its entirety.


public class PricedApt extends RentalApt {

  private double price;

Here is what I missed.

} //end class

Explanation / Answer

public class PricedApt extends RentalApt {

private double price;

//constructor goes here

public String toString()

{

}

Update: Class:

public class RentalApt extends Apartment

{
private String tenant;
private boolean rented;

public RentalApt(String owner, int size, boolean rented, String who)

{
super(owner,size);
tenant = who;
this.rented = rented;
}

public boolean getRented()

{
return rented;
}
public String getTenant()

{
return tenant;
}
public void setRented(boolean isRented)

{
rented = isRented;
}
public void setTenant(String who)

{
tenant= who;
}
public String toString()

{
String s = super.toString();
return (s + " occupied? " + rented + " tenant: " + tenant);
}

}

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