Respuesta :

Explanation:

import java.util.Scanner;

public class Student {

public static void main(String[ ] args){

//Enter 5 test scores

int[ ] marks=enterMark( );

//calculate average

double averageScore=calAverage(marks);

//calculate grade

char theGrade=letterGrade(marks);

//Display average

System.out.println("Average: "+ average Score);

//Display grade

System.out.println(" Grade: "+ theGrade);

/** method collects 5 test scores and returns reference*/

public static int[ ] enterMark( ){

int[ ] arr=new int[5];

//create Scanner object

Scanner keyboard=new Scanner(System. in);

int index=0;

while ( index<arr.length ){

System. out.print("Enter test "+ (index+1) );

arr[index]=keyboard. nextInt( );

index++;

}

return arr;

}

/**method calculates and returns average*/

public static double calAverage(int[ ] arr){

double total=0.0; //to hold total

double average=0.0;//hold average

for (int count=0; count<arr.length; count++){

total+=arr[count];

}

average=total/arr.length;

return average;

}

/** method calculates and returns grade*/

public static char letterGrade(double ave){

char grade; //to hold grade

if (ave >30)

grade='D';

if (ave >50)

grade='C';

if (ave > 60)

grade='B';

if (ave > 70)

grade='A';

else

grade='F';

return grade;

}

}