jeudi 26 mai 2016

My if Statements will default to the wrong one

        if (SuperTotal [0] == SuperTotal [1] && SuperTotal [0] == SuperTotal [2])
    {
        System.out.println ("1First: " + name [0] + ", " + name [1] + ", " + name [2]);
    }
    //1=2 & 1 > 3
    else if (SuperTotal [0] == SuperTotal [1] && SuperTotal [0] > SuperTotal [2])
    {
        System.out.println ("2First: " + name [0] + ", " + name [1] + "\nSecond: " + name [2]);
    }
    //2=3 & 2 > 1
    else if (SuperTotal [1] == SuperTotal [2] && SuperTotal [1] > SuperTotal [0])
    {
        System.out.println ("3First: " + name [1] + ", " + name [2] + "\nSecond: " + name [0]);
    }
    //1=3 & 1 > 2
    else if (SuperTotal [0] == SuperTotal [2] && SuperTotal [0] > SuperTotal [1])
    {
        System.out.println ("4First: " + name [0] + ", " + name [2] + "\nSecond: " + name [1]);
    }
    //1=2 & 1 < 3
    else if (SuperTotal [0] == SuperTotal [1] && SuperTotal [0] < SuperTotal [2])
    {
        System.out.println ("5First: " + name [2] + "'nSecond: " + name [0] + ", " + name [1]);
    }
    //1=3 & 1 < 2
    else if (SuperTotal [0] == SuperTotal [2] && SuperTotal [0] < SuperTotal [1])
    {
        System.out.println ("7First: " + name [0] + "\nSecond: " + name [1] + ", " + name [2]);
    }
    //2=3 & 2 < 1
    else if (SuperTotal [1] == SuperTotal [2] && SuperTotal [1] < SuperTotal [0])
    {
        System.out.println ("7First: " + name [0] + "\nSecond: " + name [1] + ", " + name [2]);
    }
    else if (SuperTotal [0] > SuperTotal [1] && SuperTotal [0] > SuperTotal [2] && (SuperTotal [1] < SuperTotal [2] || SuperTotal [1] > SuperTotal [2]))
    {
    }

So basically for some reason even when given different numbers that should use different "if" statements it defaults to the one that says 2=3 & 2 < 1. Do you guys, and girls, see anything that I'm doing wrong, or anything that could be more efficiently done? If so please tell me.

Aucun commentaire:

Enregistrer un commentaire