I need to create a program that tests whether three integers entered can equal the sides of a triangle. The assignment requires the use of a static method that runs the test and then the main method would call the static method.
If none of the integers entered are greater than or equal to the sum of the other two integers then the system would output "True". Otherwise, it would output "False".
Whenever I input my three numbers and then click run, the program just sits there. It doesn't give me any errors or output anything.
public class TriangularTest1 {
public static boolean isTriangular (int a, int b, int c)
{
return (a + b > c && b + c > a && c + a > b);
}
public static void main(String args[]) {
int s1 = StdIn.readInt();
int s2 = StdIn.readInt();
int s3 = StdIn.readInt();
if (isTriangular(s1, s2, s3) == true)
System.out.print("True");
else
System.out.print("False");
}
}