0

I have 3 variables: i j k. i = 9 and j k = 0. my code is doing the following test: if(i>j && i>k) and I don't get a match.

If I detail the test, i>j works and i>k not.

Am I missing something abvious?

enter image description here

here is the code:

   private void showReport(){
        int i,j,k,l;
        i = results[0];
        j = results[1];
        k = results[2];
        men2.setVisibility(View.INVISIBLE);
        men3.setVisibility(View.VISIBLE);
    String s = Integer.toString(i);
    res1.setText(s);
    s = Integer.toString(j);
    res2.setText(s);
    s = Integer.toString(k);
    res3.setText(s);

    if(lang == 0){
        if(i==MAX_LIST || j==MAX_LIST || k==MAX_LIST ){
            title34.setText("AWESOME!!! You found all the words!");
            return;
        }
        if (i<j && j<k)
            if(k>12)
                title34.setText("Excellent - you scored a very high score of " + Integer.toString(k) +
                        " good responses and you demonstrated a regular progression");
            else if(k>8) // very good - linear progression
                title34.setText("Excellent - you scored " + Integer.toString(k) +
                " good responses and you demonstrated a regular progression");
            else
                title34.setText("Very good - you demonstrated a regular progression. You just need to focus on your score");
        else if (k > i && i>4)
            if(k>12)
                title34.setText("Excellent - you scored a very high score of " + Integer.toString(k) +
                        " good responses and you demonstrated a regular progression");
            else if(k>8) // very good - linear progression
                title34.setText("Excellent - you scored " + Integer.toString(k) +
                        " good responses and you demonstrated a regular progression");
            else
                title34.setText("Very good - you demonstrated a regular progression. You just need to focus on your score");
        else {
            if (i > j && i > k)
                l = i;
            if (j > i && j > k)
                l = j;
            else
                l = k;
            if (l > 12)
                title34.setText("Excellent - you scored a very high score of " + Integer.toString(l) + "Try to improve your progression.");
            else if (l > 8)
                title34.setText("Very good - you scored " + Integer.toString(l) +
                        " good responses. Try to improve your progression.");
            else
                title34.setText("Try another time.");
        }
    }
    else {
        if(i==MAX_LIST || j==MAX_LIST || k==MAX_LIST ){
            title34.setText("BRAVO!!! vous avez trouvé tous les mots!");
            return;
        }
        if (i<j && j<k)
            if(k>12)
                title34.setText("Excellent score! il est de " + Integer.toString(k) +
                        " bonnes réponses et vous avez démontré une progression régulière.");
            else if(k>8) // very good - linear progression
                title34.setText("Excellent - votre meilleur score est de " + Integer.toString(k) +
                        " bonnes réponses et vous avez démontré une progression régulière.");
            else
                title34.setText("Très bien - vous avez démontré une progression régulière. Vous devez améliorer votre score.");
        else if (k > i && i>4)
            if(k>12)
                title34.setText("Excellent score! il est de " + Integer.toString(k) +
                        " bonnes réponses et vous avez démontré une progression régulière.");
            else if(k>8) // very good - linear progression
                title34.setText("Excellent - votre meilleur score est de " + Integer.toString(k) +
                        "  bonnes réponses et vous avez démontré une progression régulière.");
            else
                title34.setText("Très bien - vous avez démontré une progression régulière. Vous devez améliorer votre score.");
        else{
            if(i>j && i>k)
                l = i;
            if(j>i && j>k)
                l = j;
            else
                l = k;
            if(l>12)
                title34.setText("Excellent score! il est de " + Integer.toString(k) +
                        " bonnes réponses. Vous devez juste améliorer votre progression.");
            else if (l>8) {
                title34.setText("Très bien - votre meilleur score est de " + Integer.toString(l) +
                        "  bonnes réponses. Vous devez améliorer votre progression.");
            } else
                title34.setText("Essayez encore!");
        }
    }

    back.setVisibility(View.VISIBLE);

}
2
  • I'm not quite sure if I'm following what you're saying, but don't you want an else in front of if (j > i && j > k)? Commented Apr 9, 2016 at 10:11
  • yes. exactly. sorry for the disturbance and many thanks! Commented Apr 9, 2016 at 10:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.