package shapes;

public abstract class Shape
    implements Comparable {
  protected String name;

  public Shape(String shapeName) {
    name = shapeName;
  }

  public int compareTo(Object obj) {
    Shape other = (Shape) obj;
    if (this.getArea() < other.getArea()) {
      return -1;
    } else if (this.getArea() == other.getArea()) {
      return 0;
    } else {
      return 1;
    }
  }

  abstract public double getArea(); // Provided by sub-class

  public String getName() {
    return name;
  }

  public String toString() {
    return name + ":area=" + getArea();
  }

}

