// A class that represents a rectangle.
// Barry Cornelius, 20 June 2000
public class Rectangle extends Shape
{
   private int iWidth;
   private int iHeight;
   public Rectangle()
   {
      this(0, 0, 0, 0);
   }
   public Rectangle(final int pWidth, final int pHeight,
                    final int pX, final int pY)
   {
      super(pX, pY);
      iWidth = pWidth;
      iHeight = pHeight;
   }
   public int getWidth()
   {
      return iWidth;
   }
   public int getHeight()
   {
      return iHeight;
   }
   public boolean equals(final Object pObject)
   { 
      if ( pObject==null || getClass()!=pObject.getClass() )
      {
         return false;
      }
      final Rectangle tRectangle = (Rectangle)pObject;
      return super.equals(pObject) &&
             iWidth==tRectangle.iWidth && 
             iHeight==tRectangle.iHeight;
   }
   public int hashCode()
   {
      return super.hashCode() + iWidth + iHeight;
   }
   public String toString()
   {
      return super.toString() + ":" + iWidth + ":" + iHeight;
   }
}
