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;
}
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
<em> if(average>= 90 && average <=100){ grade ='A'; }</em>
If average is between 80 and 89 (inclusive), grade is B
<em> else if(average>= 80 && average <=89){ grade ='B'; }</em>
If average is between 70 and 79 (inclusive), grade is C
<em> else if(average>= 70 && average <=79){ grade ='C'; }</em>
If average is between 60 and 69 (inclusive), grade is D
<em> else if(average>= 60 && average <=69){ grade ='D'; }</em>
If average is between 0 and 59 (inclusive), grade is F
<em> else if(average>= 0 && average <=59){ grade ='F'; }</em>
This returns the grade
return grade;
}