Hi! This set of nested if-else statements is logically correct (I think), but my code fails every one of GodeGym's requirements, and I can't figure out why. Any thoughts?
package com.codegym.task.task04.task0415;
/*
Rule of the triangle
1.The program should read three numbers from the keyboard.
2.The program should display text on the screen according to the task conditions.
3.If a triangle with the specified sides could exist, you need to display: "The triangle is possible."
4.If a triangle with the specified sides cannot exist, you need to display: "The triangle is not possible."
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner scanner = new Scanner(System.in);
scanner.useDelimiter("\n");
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
if (a >= b && a >= c) {
int sum2 = b + c;
if (sum2 > a)
System.out.println("The triangle is possible.");
else
System.out.println("The triangle is not possible.");
}
else if (b >= a && b >= c) {
int sum3 = a + c;
if (sum3 > b)
System.out.println("The triangle is possible.");
else
System.out.println("The triangle is not possible.");
}
else if (c >= a && c >= b) {
int sum1 = a + b;
if (sum1 > c)
System.out.println("The triangle is possible.");
else
System.out.println("The triangle is not possible.");
}
else {
}
}
}