Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that reads in the lengths of the three sides of a triangle. Firs

ID: 3743332 • Letter: W

Question

Write a program that reads in the lengths of the three sides of a triangle. First, verify that the lengths do form a triangle: adding any two sides should yield a number that exceeds the third. Next, if it is a triangle, determine if the triangle is equilateral: all sides would have equal length; determine if the triangle is isosceles: two sides have equal length, which is different from the third. Finally, determine if the triangle is right-angled: the sum of the square of two sides would yield the square of the third.

Example input/output:

Enter the lengths of three sides of the triangle: 3.3 19.6 3.3

Output:

The three sides donot form a triangle.

Enter the lengths of three sides of the triangle: 3.3 3.3 3.3

Output:

The three sides form a triangle. The triangle is equilateral

.Enter the lengths of three sides of the triangle: 3 4 5

Output:The three sides form a triangle. The triangle is right-angled.

Enter the lengths of three sides of the triangle: 6.3 6.3 5

Output:The three sides form a triangle. The triangle is isosceles.

Explanation / Answer

import java.util.Scanner; public class TriangleType { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the lengths of three sides of the triangle: "); double s1 = in.nextDouble(), s2= in.nextDouble(), s3 = in.nextDouble(); if(s1+s2
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote