1  public class Rectangle extends GeometricObject {
  2    private double width;
  3    private double height;
  4  
  5    public Rectangle() {
  6    }
  7  
  8    public Rectangle(double width, double height) {
  9      this.width = width;
 10      this.height = height;
 11    }
 12  
 13    /** Return width */
 14    public double getWidth() {
 15      return width;
 16    }
 17  
 18    /** Set a new width */
 19    public void setWidth(double width) {
 20      this.width = width;
 21    }
 22  
 23    /** Return height */
 24    public double getHeight() {
 25      return height;
 26    }
 27  
 28    /** Set a new height */
 29    public void setHeight(double height) {
 30      this.height = height;
 31    }
 32  
 33    @Override /** Return area */
 34    public double getArea() {
 35      return width * height;
 36    }
 37  
 38    @Override /** Return perimeter */
 39    public double getPerimeter() {
 40      return 2 * (width + height);
 41    }
 42  
 43    @Override /** Return a string representation of a Rectangle object */
 44    public String toString() {
 45      return super.toString() + " width: " + width + " height: " + height;
 46    }
 47  }