Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. A right-angled triangle is a triangle in which one angle is a right angle (90 degrees) and the largest side is called hypotenuse, c
3. A right-angled triangle is a triangle in which one angle is a right angle (90 degrees) and the largest side is called hypotenuse, c (refer to figure below). b a If the triangle is a right-angled triangle, the relationship between the sides of the triangle is as follows: c = (a + b) where c is the hypotenuse. Write a program that can test whether a triangle is right-angled or not. The program begins by reading from the user three (double-typed) numbers representing the three sides of a triangle. The user can enter the three sides in any order and the largest number is considered as the hypotenuse. Then, the program displays "Yes, this is a right-angled triangle." if it is a right-angled triangle or NO, this is not a right-angled triangle." otherwise. Next, the program will ask the user whether to continue with the next set of inputs. If the user wants to continue, the program will repeat to do the same thing for the next three numbers. Otherwise, the program will stop reading and it will display the total number of right-angled triangles that the user have entered. An example of the program's running is given below (Note: The bold texts below are inputs entered by the user) Enter the three sides of a triangle> 5 3 4 Yes, this is a right-angled triangle. Do you want to continue? (y)> y Enter the three sides of a triangle> 12 13 5 Yes, this is a right-angled triangle. Do you want to continue? (y)> y Enter the three sides of a triangle> 92 43 96 No, this is not a right-angled triangle. Do you want to continue? (y)> n The total number of right-angled triangle = 2 Name of source code file to be submitted: Asg23.java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started