Write a Java program that inputs three integer variables (called a, b, and c) that represent the length of the sides of a triangle. Your program should store the type of the triangle in an enumeration variable (called type), and display the value of the variable type. Here are the steps to follow: 1- Defines an enumeration to represent the different triangle types: EQUILATERAL, ISOSCELES, SCALENE, and ERROR. The type ERROR is added in case that the value of any triangle sides is less than or equal to zero. 2- Declare then input the three integer variables a, b, and c using a scanner object called keyboard. 3- Declare the enumeration variable type. 4- Determine the type of the rectangle (i.e. Assign a value to the variable type) 5- Print the value of the variable type. NOTE: If all sides are equal, the rectangle is EQUILATERAL. If only two sides are equal, the rectangle is ISOSCELES, otherwise the rectangle is SCALENE. Note that the type of the rectangle should be ERROR if the length of any side is invalid.
Write a Java program that inputs three integer variables (called a, b, and c) that represent the length of the sides of a triangle. Your program should store the type of the triangle in an enumeration variable (called type), and display the value of the variable type.
Here are the steps to follow:
1- Defines an enumeration to represent the different triangle types: EQUILATERAL, ISOSCELES, SCALENE, and ERROR. The type ERROR is added in case that the value of any triangle sides is less than or equal to zero.
2- Declare then input the three integer variables a, b, and c using a scanner object called keyboard.
3- Declare the enumeration variable type.
4- Determine the type of the rectangle (i.e. Assign a value to the variable type)
5- Print the value of the variable type.
NOTE: If all sides are equal, the rectangle is EQUILATERAL.
If only two sides are equal, the rectangle is ISOSCELES,
otherwise the rectangle is SCALENE.
Note that the type of the rectangle should be ERROR if the length of any side is invalid.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images