package cse1030.test2; import cse1030.drawing.Point2D; /** * A line shape. Each line is defined by the position of * its two end points. The bounding box for * a line is the rectangle with opposite corners located * at the end points of the line. The line end points * cannot be changed after the line is created. * * @author CSE1030_F13_14 * */ public class Line extends Shape { /** * Create a line with end points p1 and p2. * * @param p1 one end point of the line * @param p2 the other end point of the line */ public Line(Point2D p1, Point2D p2) { // NOTE TO STUDENTS: The position of the bounding box is midway // between p1 and p2. If p1 has coordinates (x1, y1) and // p2 has coordinates (x2, y2) then the point midway between p1 and p2 // has coordinates (x, y) such that: // // x = (x1 + x2) / 2 // y = (y1 + y2) / 2 } /** * Returns the first end point of the line. * * @return the first end point of the line */ public Point2D getPoint1() { } /** * Returns the second end point of the line. * * @return the second end point of the line */ public Point2D getPoint2() { } /** * Returns zero (the area of the line). * * @return 0 * @see cse1030.test2.Shape#getArea() */ public double getArea() { } }