public class Rectangle extends Shape { private double width, height; public Rectangle(double upperLeftX, double upperLeftY, double w, double h) { super(upperLeftX + w/2, upperLeftY + h/2); width = w; height = h; } public double area() { return width * height; } public double perimeter() { return 2*(width + height); } public int numberOfSides() { return 4; } public boolean isGolden() { double ratioOfSides = Math.abs(Math.max(width, height) / Math.min(width, height)); return (ratioOfSides - 0.5*(1 + Math.sqrt(5))) < 0.001; } }