mercredi 4 mars 2015

else if statement not working

I am new to Java and really kind of teaching myself. I am practising with the else and if statement. I have written the below very basic program for grading a score but i cannot get all of the else if statements to work properly, it invokes the first two and i can get it to display the A and B grades but not the rest, i have tried moving and removing the squiggly brackets and such but still wont work. Please help and excuse my ignorance as i am new to Java programming.


Thanks in advance.


public class Grade {



public static void main(String[] arguments) {
int grade = 69;
if (grade > 90) {
System.out.println("Well done you got a A");
} else if (grade < 90) {
System.out.println("Well done you got a B");
} else if (grade < 85) {
System.out.println("You got a C");
} else if (grade < 75) {
System.out.println("You got a D");
} else if (grade < 75) {
System.out.println("You got a E");
} else {
System.out.println("You got a F");
}
}


}


Aucun commentaire:

Enregistrer un commentaire