public class Rectangle implements Polygon { private double width; private double height; public Rectangle(double width, double height) { this.width = width; this.height = height; } public double perimeter() { return 2*(width + height); } public double area() { return width*height; } public double diameter() { return Math.hypot(width, height); } public int numSides() { return 4; } }