

/*******************************************************
 * For simplicity, the two parallel sides of the trapezoid
 * are assumed to be horizontal.  The trapezoid is determined
 * by four points (p1, p2, p3, p4).  p1 is assumed to be the
 * upper left hand corner and the other points are assumed to
 * be listed in clockwise order.
 *******************************************************/
 
class Trapezoid extends Quadrilateral
{

  public Trapezoid( Point pt1, Point pt2, Point pt3, Point pt4 )
  {
     super( pt1, pt2, pt3, pt4 );	// Call constructor for Quadrilateral

     // Check to see if top and bottom are horizontal
 
     if ( pt1.y != pt2.y )
     {
        System.out.println("Trapezoid constructor: 2nd point not on same"
                           + " horizontal line with point p2.");
        System.out.println("Setting p2.y = p1.y so upper line is horizontal.");

        p2.y = pt1.y;
     }

     if ( pt3.y != pt4.y )
     {
        System.out.println("Trapezoid constructor: 4th point not on same"
                           + " horizontal line with point p3.");
        System.out.println("Setting p4.y = p3.y so upper line is horizontal.");

        p4.y = pt3.y;
     }

   }

  // Note that paint() is inherited from Quadrilateral
}
