int main()
{
    float a,b,c;
    cin>>a >> b >>c;
    if(a<(b+c) && b < (a+c) && c< (a+b))
    {
        cout<<"\nIt is a Triangle.”;
        if (a==b && b==c)
            cout<<"\nIt is a Equiletaral Triangle.”;
        if(a==b || a==c || b==c)
            cout<<"\nIt is a Isoceles Triangle.”;
        else
            cout<<"\nIt is a Scalene Triangle.”;
    }
    else
        cout<<"This Triangle is not possiable.”;
    return 0;
}

I want to convert this code in java and run junit testing on java code

import java.util.Scanner; //This allows you to get user input in Java.

public class Test {
    public static void main(String[] args)
    {
        double a, b, c;
        Scanner scan = new Scanner(System.in);

        System.out.print("Enter three numbers: ");
        a = scan.nextDouble();
        b = scan.nextDouble();
        c = scan.nextDouble();
        System.out.println();

        if(a<(b+c) && b<(a+c) && c<(a+b))
        {
            System.out.println("It is a triangle.");
            if(a==b && b==c)
            {
                System.out.println("It is an Equilateral Triangle.");
            }
            else if(a==b || a==c || b==c)
            {
                System.out.println("It is an Isoceles Triangle.");
            }
            else 
            {
                System.out.println("It is an Scalene Triangle.");
            }
        }
        else 
        {
            System.out.println("This triangle is not possible.");
        }
    }
}
This article has been dead for over six months. Start a new discussion instead.