// CSE 143, Winter 2009, Marty Stepp // A Rectangle object represents a 2D rectangle shape with a given width/height. public class Rectangle implements Shape { private double width; private double height; // Constructs a new rectangle with the given dimensions. public Rectangle(double width, double height) { this.width = width; this.height = height; } // Returns the area of this rectangle. public double area() { return width * height; } // Returns the perimeter of this rectangle. public double perimeter() { return 2 * (width + height); } }