Question: Please update the following program: import java.util.Scanner; public class GradesforSam { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int TOTAL_GRADES =

Please update the following program:

import java.util.Scanner;

public class GradesforSam {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int TOTAL_GRADES = 0;

int i;

int sumGrade;

int minGrade;

int maxGrade;

double avgGrade;

char letterGrade = 0;

System.out.println("Hi Sam, how many total grades do you want to process?");

TOTAL_GRADES = scnr.nextInt();

int[] userGrade = new int[TOTAL_GRADES];

for (i = 0; i < userGrade.length; ++i)

{

System.out.println("Please enter grade " + (i+1) + ":");

userGrade[i] = scnr.nextInt();

}

sumGrade = 0;

minGrade = 0;

maxGrade = 0;

for (i = 0; i < userGrade.length; ++i)

{

sumGrade = sumGrade + userGrade[i];

if (userGrade[i] > maxGrade)

{

maxGrade = userGrade[i];

}

if (userGrade[i] < minGrade)

{

minGrade = userGrade[i];

}

}

if ((avgGrade >= 90) && (avgGrade <= 100))

{

letterGrade = 'A';

}

else if ((avgGrade >= 80) && (avgGrade <= 89))

{

letterGrade = 'B';

}

else if ((avgGrade >= 70) && (avgGrade <= 79))

{

letterGrade = 'C';

}

else if ((avgGrade >= 60) && (avgGrade <= 69))

{

letterGrade = 'D';

}

else if ((avgGrade >= 0) && (avgGrade <= 59))

{

letterGrade = 'F';

}

avgGrade = 1.0 * sumGrade/TOTAL_GRADES;

System.out.println("Your total score is: " + sumGrade);

System.out.println("Lowest score is: "+ minGrade);

System.out.println("Highest score is "+ maxGrade);

System.out.printf("Average score is: %.2f ",avgGrade);

System.out.println("Your grade so far is a " + letterGrade);

}

}

Create a method called getTotalScore that has 1 array parameter, and returns the total in the array

Create a method called getLowestScore that has 1 array parameter, and returns the lowest element in the array

Create a method called getHighestScore that has 1 array parameter, and returns the highest element in the array

Create a method called getAverage that has 2 parameters (the totalScore and size of the array), and returns the average score

Create a method called printGrade, that takes 1 parameter (your average score), and prints out your grade, based on the grade scale that is on our course Syllabus. [

Use JavaDoc style comments above all 5 methods, and your class header. Generate javadocs using the javadoc tool, and zip up the doc folder. Submit the doc.zip file with your submission

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!