
class Quadrilateral extends Polygon
{
   // Instance variables

   protected Point p1, p2, p3, p4;	// Four corners in clockwise order

   public Quadrilateral()
   { 
      p1 = new Point();
      p2 = new Point();
      p3 = new Point();
      p4 = new Point();
   }

   public Quadrilateral( Point p1, Point p2, Point p3, Point p4 )
   {
       this();
       this.p1.x = p1.x; this.p1.y = p1.y;
       this.p2.x = p2.x; this.p2.y = p2.y;
       this.p3.x = p3.x; this.p3.y = p3.y;
       this.p4.x = p4.x; this.p4.y = p4.y;
   }

   public void paint( Graphics g )
   {
      g.drawLine( p1.x, p1.y, p2.x, p2.y );
      g.drawLine( p2.x, p2.y, p3.x, p3.y );
      g.drawLine( p3.x, p3.y, p4.x, p4.y );
      g.drawLine( p4.x, p4.y, p1.x, p1.y );
   }
}
