Hello. I don't understand what all this is for:
avg= sum/ numberofgrades;
System.out.println("Total number of grades is "+ numberofgrades);
System.out.println("Total number of A's is "+A);
System.out.println("Total number of B's is "+B);
System.out.println("Total number of C's is "+C);
System.out.println("Total number of D's is "+D);
System.out.println("Total number of F's is "+F);
System.out.println("Average score is "+ avg);
The assignment did not ask for you to do that. From my understanding of your assignment, all it asked you to do was to check if the score you inputted is a A or B or C or D or F. The method that is used to check the score has to be called from the main method, so it would make sense for you to do something like Bawnawgwa said.
This part of the code should go into the static method (calculateGrade).
if(grade>=90.0 && grade <= 100.0){
A++;
}
if(grade>=80.0 && grade <= 89.9){
B++;
}
if(grade>=70.0 && grade <= 79.9){
C++;
}
if(grade>=60.0 && grade <= 69.9){
D++;
}
else if(grade>=0.0 && grade <= 59.9){
F++;
}
Hope that helps.
EDIT (If someone don't mind answering): Now, I wonder...How would I make the code so it would only run the The score...blah blah... is a <letter>
AFTER all the points are inputted?
Example:
Enter grade or -1 to exit:
90
Enter grade or -1 to exit:
100
Enter grade or -1 to exit:
-1
The score 90 is an A.
The score 100 is an A.