Question: Implement a class Triangle that represents triangles. The constructor should accept the lengths of a triangles three sides as integers and verify that they are
Implement a class Triangle that represents triangles. The constructor should accept the lengths of a triangles three sides as integers and verify that they are valid by testing whether the sum of the lengths of any two sides exceeds the length of the third side. If the triangle is not valid, print a message to the screen saying that and set all three variables to -99. The class should define three boolean-valued methods isRight, isIsosceles, isEquilateral which test whether the triangle is right, isosceles, or equilateral. Write a toString method that displays the side lengths of the triangles in the following format:
a:3
b:3
c:3
Write an equals method that returns true is the triangle has equal sidelengths.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
