Seems to work when I run, but not passing the 'verify' stage. Any ideas?
package com.codegym.task.task04.task0415;
/*
Rule of the triangle
"The triangle is possible." - if a triangle with these sides could exist.
"The triangle is not possible." - if a triangle with these sides cannot exist.
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String a = reader.readLine();
String b = reader.readLine();
String c = reader.readLine();
int d = makeInt(a);
int e = makeInt(b);
int f = makeInt(c);
if(test(d,e,f)) {
System.out.println("The triangle is possible.");
} else {
System.out.println("The triangle is not possible.");
}
}
public static int makeInt(String a) {
int val = Integer.parseInt(a);
return val;
}
public static boolean test(int a, int b, int c) {
Boolean test = true;
if( a + b < c || a + c < b || b + c < a){
test = false;
}
return test;
}
}
package com.codegym.task.task04.task0415;
/*
Rule of the triangle
"The triangle is possible." - if a triangle with these sides could exist.
"The triangle is not possible." - if a triangle with these sides cannot exist.
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String a = reader.readLine();
String b = reader.readLine();
String c = reader.readLine();
int d = makeInt(a);
int e = makeInt(b);
int f = makeInt(c);
if(test(d,e,f)) {
System.out.println("The triangle is possible.");
} else {
System.out.println("The triangle is not possible.");
}
}
public static int makeInt(String a) {
int val = Integer.parseInt(a);
return val;
}
public static boolean test(int a, int b, int c) {
Boolean test = true;
if( a + b < c || a + c < b || b + c < a){
test = false;
}
return test;
}
}