Question: java Triangle Program ANY two sides of a triangle must be greater th an the len to actually form a triangle. (See back page, for
Triangle Program ANY two sides of a triangle must be greater th an the len to actually form a triangle. (See back page, for hints on how to test for the different types o for hints on honcth of the third side in order for the segments es of triangles) (For example, 2, 2 anddo NOT form a triangle since 2 + 2 = 4, where 2, s andDO form a triangle since 2 +854 Using this logic, write two programs, one called Triangle.java and one called Test TriangleJava that tests for triangles. TEACHER NOTE: BE SURE to check all combinations of sides; a+ b>c AND b + ca A Specifications in class Triangle: k all combinations of sides; a + b > c AND b + c24 AND a 1. Private (double) fields called sideA sideB, SideC 2. At least one constructor method called Triangle ) that sets the sides to 2 s. Methods setSideA setSideBand setSideC) 3. Methods aesd tsidace (oR you may combine this to ONE method alld setData()) 4. Methods getSideA getSideB) and getSideC 5. Method computePerimeter(sideA + sideB+ SideC) 6. Method displayData(0 that displays the values of the 3 sides. Specifications in Test Triangle: 7. Ask for user input to create at least FOUR triangle objects with the following values and suggested output messages: 2, 2,5 ("not triangle message") 3, 3, 3 ("an equilateral triangle message") 8.7,8.7, 11 ("an isosceles triangle message") 18, 24, 30 ("a scalene triangle message") and EXTRA CREDIT will also indicate "a right triangle 18, 24, 30 ('a scalene triangle message") and EXTRA CREDIT will also indicate'"a message s. Method TriangleType s( ) that tests to see if the sides do indeed form a triangle. If so, indicates "equilateral", "isosceles", or And compute the perimeter of the (correct) triangles Method isRight'Triangle) that tests to see if the triangle is right (eo degree angle), and, if so, also indicates "right triangle for that object on the output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
