Define a class named RandomRightTriangle that represents right triangles whose sides lie entirely within a given square region. A RandomRightTriangle object should be able to report its vertices as...



Define a class named RandomRightTriangle that represents right triangles whose sides lie entirely within a given square region. A RandomRightTriangle object should be able to report its vertices as Point objects and draw itself. Use the class LineSegment, as described in the previous exercise, to represent the triangle’s sides. Hint: Define the hypotenuse of the triangle as a LineSegment object whose endpoints are chosen randomly. These end-points are two vertices of the triangle. Let the third vertex be the vertex of the right angle, as you can determine its coordinates from the coordinates of the other two vertices.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here