public class Rect extends Shape { private int width; private int height; public Rect() { super(); width = height = 0; } public Rect(int xLoc, int yLoc, int width, int height) { super(xLoc, yLoc); this.width = width; this.height = height; } public double getArea() { return width * height; } public void stretchBy(double factor) { width = (int)Math.round(width * factor); height = (int)Math.round(height * factor); } public String toString() { String str = "RECTANGLE \n" + super.toString() + "Width & Height: " + width + " " + height + "\n" + "Area: " + getArea(); return str; } }