Define a class named LineSegment that represents line segments whose endpoints lie within a given square region. A LineSegment object should be able to report its endpoints as Point objects and draw...


Define a class named LineSegment that represents line segments whose endpoints lie within a given square region. A LineSegment object should be able to report its endpoints as Point objects and draw itself. Define three parameterized constructors, each of which is given the length of the side of the bounding square region as a parameter, as follows:


• Two additional parameters specify the line’s endpoints as Point objects.


• One additional parameter specifies one endpoint of the line as a Point object; the second endpoint is  generated at random.


• Both endpoints are generated at random as Point objects.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here