Question: Please update the following program: import java.util.Scanner; public class GradesCathy { public static char LetterGrade(double mark){ if(mark <60){ return 'F'; } else if(mark <70){ return
Please update the following program:
import java.util.Scanner; public class GradesCathy { public static char LetterGrade(double mark){ if(mark<60){ return 'F'; } else if(mark<70){ return 'D'; } else if(mark<80){ return 'C'; } else if(mark<90){ return 'B'; } else { return 'A'; } } public static void main(String args[]){ Scanner scanner = new Scanner(System.in); System.out.print("Hello Renee, how many total grades do you want to process? "); int n = scanner.nextInt(); int arr[] = new int[n]; for(int i = 1;i<=n;i++){ System.out.print("Please enter grade "+i+": "); arr[i-1] = scanner.nextInt(); } int sum = 0; double avg = 0; int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int i = 0;i arr[i]){ min = arr[i]; } if(max < arr[i]){ max = arr[i]; } } avg = 1.0*sum/n; System.out.println("Your total score is: "+ sum); System.out.println("Lowest score is: "+min); System.out.println("Highest score is "+max); System.out.printf("Average score is: %.2f ",avg); System.out.println("Your grade so far is a "+LetterGrade(avg)); } }
Update the program above to include methods.
1. Create a method called getTotalScore that has 1 array parameter, and returns the total in the array.
2. Create a method called getLowestScore that has 1 array parameter, and returns the lowest element in the array,
3. Create a method called getHighestScore that has 1 array parameter, and returns the highest element in the array
4. Create a method called getAverage that has 2 parameters (the totalScore and size of the array), and returns the average score
5. Create a method called printGrade, that takes 1 parameter (your average score), and prints out your grade, based on the grade scale A: 90-100 B:80-89 C:70-79 D:60-69 F: 59-0
6. 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. (PLEASE EXPLAIN HOW TO DO #6)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
