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

public class Shed{ private String owner; private int size; public Shed(String wh

ID: 3621886 • Letter: P

Question

public class Shed{
private String owner;
private int size;

public Shed(String who, int area){
owner = who;
size = area;
}

public String getOwner(){return owner;}
public int getSize(){return size;}

public String toString()
{return("owner: " + owner + " size: " + size);}
}

"Some sheds you install have electricity, while others do not. Create a subclass of the Shed class using inheritance called ElectricShed, and enter your code in the box below. This class should have one additional attribute, electric, of type boolean. When the attribute electric is true, the shed has electricity; if electric is false, the shed does not have electricity. The class should have just one constructor, with three parameters, owner, size, and electrified (boolean). Be sure to use super in your code in the derived class constructor."

also, Finally add one additional method to the ElectricShed class, a static method called electricOwners. This method should be passed an array of ElectricSheds, and should print to the console the names of all owners who own sheds that have electricity. If one person owns more than one electric shed, it's ok to display their names multiple times.

Explanation / Answer

Hope this helps. Let me know if you have any questions. Please rate. :) public class ElectricShed extends Shed { private boolean electric; public ElectricShed(String who, int area, boolean electrified) { super(who, area); electric = electrified; } public static void printElectricOwners(ElectricShed[] sheds) { for (int i = 0; i