A class Segment that implements SegmentInterface,
and also provides these additional methods:
- boolean isHorizontal();
- boolean isVertical();
- void move(Point newLowerOrLeft);
- String toString();
The move method changes the position of the entire segment
by moving the lower point to the new position. In other words, the
entire segment moves, without changing its length or angle, so that the
lower point is in the new position. For horizontal segments (where
both endpoints have the same y coordinate), it moves the left point
to the new position.
The toString method returns the string
"(x1,y1)-(x2,y2)", where (x1,y1) is the lower endpoint of the segment,
or the left endpoint for horizontal segments.