
class Square extends Polygon
{
   // Instance variables

   private Point upperLeft;	// Upper left corner of square
   private int side;		// Length of side

   public Square()		// 0-param constructor
   { this( new Point(0,0), 1 ); }	// Default values

   public Square( Point ul, int side) // 3-param constructor
   {
       upperLeft = new Point();
       upperLeft.x = ul.x;  upperLeft.y = ul.y;
       this.side = side;
   }

   public void paint( Graphics g )
   {
      g.drawLine(upperLeft.x, upperLeft.y,
                 upperLeft.x+side, upperLeft.y);
      g.drawLine(upperLeft.x+side, upperLeft.y,
                 upperLeft.x+side, upperLeft.y+side);
      g.drawLine(upperLeft.x+side, upperLeft.y+side,
                 upperLeft.x, upperLeft.y+side);
      g.drawLine(upperLeft.x, upperLeft.y+side,
                 upperLeft.x, upperLeft.y);
   }
}

