Question: Java Write a program that prompts to user to enter three side length values of a triangle and checks if these values form a valid
Java
Write a program that prompts to user to enter three side length values of a triangle and checks if these values form a valid triangle. The program should print "Valid Triangle!" if it is a valid triangle, and "Invalid Triangle!" otherwise. It is a valid triangle if the sum of every pair of two side lengths is greater than the remaining pair.
For example:
| Input | Result |
|---|---|
8.0 15 17 | Enter side1 of a triangle: Enter side2 of a triangle: Enter side3 of a triangle: Valid Triangle! |
8.5 17.5 40 | Enter side1 of a triangle: Enter side2 of a triangle: Enter side3 of a triangle: Invalid Triangle! |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
