/* * File: Quadrilateral.java * * Quadrilateral class * * Copyright: Northeast Parallel Architectures Center * */ import java.awt.Point; // A quadrilateral is a polygon with four sides: public class Quadrilateral extends MovablePolygon { // Quadrilateral constructor #1: public Quadrilateral() { // invoke the no-argument constructor of the superclass: super(); } // Quadrilateral constructor #2: public Quadrilateral( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4 ) { // invoke the no-argument constructor of the superclass: super(); // the 'this' reference is optional: this.addPoint( x1, y1 ); this.addPoint( x2, y2 ); this.addPoint( x3, y3 ); this.addPoint( x4, y4 ); } // Quadrilateral constructor #3: public Quadrilateral( Point p1, Point p2, Point p3, Point p4 ) { // invoke Quadrilateral constructor #2: this( p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y ); } }