Answer:
The method in Java is as follows:
public static char letterGrade(int average){
char grade =' ';
if(average>= 90 && average <=100){ grade ='A'; }
else if(average>= 80 && average <=89){ grade ='B'; }
else if(average>= 70 && average <=79){ grade ='C'; }
else if(average>= 60 && average <=69){ grade ='D'; }
else if(average>= 0 && average <=59){ grade ='F'; }
return grade;
}
Step-by-step explanation:
This defines the method
public static char letterGrade(int average){
This initializes the grade to a blank
char grade =' ';
If average is between 90 and 100 (inclusive), grade is A
if(average>= 90 && average <=100){ grade ='A'; }
If average is between 80 and 89 (inclusive), grade is B
else if(average>= 80 && average <=89){ grade ='B'; }
If average is between 70 and 79 (inclusive), grade is C
else if(average>= 70 && average <=79){ grade ='C'; }
If average is between 60 and 69 (inclusive), grade is D
else if(average>= 60 && average <=69){ grade ='D'; }
If average is between 0 and 59 (inclusive), grade is F
else if(average>= 0 && average <=59){ grade ='F'; }
This returns the grade
return grade;
}