public class Rectangle implements Shape, Cloneable, java.io.Serializable {
  // Constructors
  public Rectangle() {
    upperleftx=0;
    upperlefty=0;
    width=0;
    height=0;
  }

  public Rectangle(float x1, float y1, float w, float h){
    upperleftx = x1;
    upperlefty = y1;
    width = w;
    height = h;
  }

  // Accessors
  public float getUpperleftx() {
    return upperleftx;
  }

  public float getUpperlefty() {
    return upperlefty;
  }

  public float getWidth() {
    return width;
  }

  public float getHeight() {
    return height;
  }

  // Canonical form methods
  public boolean equals(Object other) {
    if (this==other) {
      return true;
    }

    if (other instanceof Rectangle) {
      Rectangle otherObj=(Rectangle) other;

      if (upperleftx!=otherObj.upperleftx) {
        return false;
      }

      if (upperlefty!=otherObj.upperlefty) {
        return false;
      }

      if (width!=otherObj.width) {
        return false;
      }

      if (height!=otherObj.height) {
        return false;
      }

      return true;
    }

    return false;
  }

  public int hashCode() {
    int hash=0;

    hash=hash*37+(int) upperleftx;
    hash=hash*37+(int) upperlefty;
    hash=hash*37+(int) width;
    hash=hash*37+(int) height;

    return hash;
  }

  public Object clone() throws CloneNotSupportedException {
    Rectangle result=(Rectangle) super.clone();

    return result;
  }

  public String toString(){
    String returnString;
    returnString = "Regtang whose upper-left at (" + upperleftx + "," + upperlefty + ") and with width:" + width +" and height:" + height;
    return returnString;
  }

  // Mutators
  public void setUpperleftx(float f) {
    upperleftx=f;
  }

  public void setUpperlefty(float f) {
    upperlefty=f;
  }

  public void setWidth(float f) {
    width=f;
  }

  public void setHeight(float f) {
    height=f;
  }

  // Fields
  protected float upperleftx, upperlefty, width, height;
}