
Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program:
? calcAverage - This method should accept five test scores as arguments and return the average of the scores.
? determineGrade - This method should accept a test score as an argument and return a letter grade for the score, based on the following grading scale:
Score Letter Grade 90 - 100 A 80 - 89 B 70 - 79 C 60 - 69 D Below 60

import java.util.*;
public class Student{
public static int calcAverage(int scores[]){
int sum=0;
int average=0;
for(int i=0;i<scores.length;i++){
sum+=scores[i];
}
int total=scores.length;
average=sum/total;
return average;
}
public static String determineGrade(int score){
if(score>=90&&score<=100){
return "A";
}
if(score>=80&&score<=89){
return "B";
}
if(score>=70&&score<=79){
return "C";
}
if(score>=60&&score<=69){
return "D";
}
if(score<60){
return "E";
}
return "";
}
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.println("Enter 5 scores: ");
int scores[]=new int[5];
for(int i=0;i<scores.length;i++){
scores[i]=input.nextInt();
}
int avgOfMarks=calcAverage(scores);
System.out.println();
System.out.println("Scores and Grades:");
for(int i=0;i<scores.length;i++){
System.out.println(scores[i]+"\t- "+determineGrade(scores[i]));
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.