public class ColoredPoint extends Point
{ private String color="black";

  public ColoredPoint(double x, double y, String color)
  { super(x,y);  // invokes the parent constructor
    this.color = color;
  }
  
  public String getColor()
  { return color;
  }

  public void setColor(String color)
  { this.color = color;
  }

  public boolean equals(Object object)
  { if (object == this) return true;
    if (object.getClass() != this.getClass()) return false;
    if (object.hashCode() != this.hashCode()) return false;
    ColoredPoint point = (ColoredPoint)object;
    return (x == point.x && y == point.y && color == point.color);
  }

  public int hashCode()
  { return (new Double(x)).hashCode() + (new Double(y)).hashCode()
           + color.hashCode();
  }

  public String toString()
  { return new String("(" + x + ","  + y + ", " + color + ")");
  }
}
