

/*******************************************************
 * The parallelogram 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.
 *
 * For simplicity, the two sides with end points (p1,p2) and (p3,p4) of
 * the parallelogram are assumed to be horizontal.

 *******************************************************/
 
class Parallelogram extends Trapezoid
{
  public Parallelogram( Point p1, Point p2, Point p3, Point p4 )
  {
     super( p1, p2, p3, p4 );	// Call constructor for super class Trapezoid

     // Check to see if sides are parallel
    
     Line leftSide = new Line(this.p4,this.p1);
     Line rightSide = new Line(this.p3,this.p2);
     if ( !leftSide.isParallel( rightSide ) )
     {
         System.out.println("Parallelogram constructor:  Sides not parallel."
                            + " Adjusting x-coor of pt p3 to make them ||.");
         this.p3.x = p2.x + (p4.x - p1.x);
     }
 
   }

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