Write a method called isIsoceles that accepts three integer parameters that represent the lengths of the sides of a triangle. The method returns true if the triangle is isosceles but not equilateral (meaning that exactly two of the sides have an equal length), and false otherwise.
What will be an ideal response?
```
public boolean isIsoceles(int side1, int side2, int side3)
{
boolean result = false;
if ( (side1 == side2) && side1 != side3) ||
(side2 == side3) && side2 != side1) ||
(side1 == side3) && side1 != side2) )
result = true;
return result;
}
```
You might also like to view...
A texture fill blends two or more colors
Indicate whether the statement is true or false
Which of the following mouse actions will cause a shortcut menu to display?
A) right-click B) double-click C) pointing D) click and drag
What are icon sets?
What will be an ideal response?
Answer the following statement(s) true (T) or false (F)
1. The condition used in an if statement can be any valid C++ expression. 2. In C++, strings of characters cannot be compared. 3. A common problem with the if-else statement is using the assignment operator, =, in place of the relational operator ==. 4. Before the current ANSI/ISO C++ standard, C++ didn’t have a built-in Boolean data type with its two Boolean values, true and false. 5. In C++, the postfix and prefix -- operators can be applied to Boolean variables.