Need to make this: Write a Java program named GradeConverter.java that does the
ID: 3590892 • Letter: N
Question
Need to make this:
Write a Java program named GradeConverter.java that does the following Prompts the user for how many test scores are to be entered. Using a "for" loop asks the user for the scores for each test. The range is 0 to 100 points. Immediately after a score is entered presents back to the student the letter grade equivalent according to the following: A> 92, B is 85 to 92, C is 77 to 84, D is 68 to 76, F is 67 and below After the "for" loop print the following: The average grade, both as a number and as its letter equivalent. The highest grade, both as a number and its letter equivalent. . Hints: You might want write a method that takes as a parameter a double and returns a String with the letter grade. 1. public static String getLetterGrade ( double grade) ( if (Explanation / Answer
package org.students;
import java.util.Scanner;
public class GradeConverter {
public static void main(String[] args) {
//Declaring variables
int n, highest = Integer.MIN_VALUE, score, sum = 0;
/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);
//Getting the input entered by the user
System.out.print("How many Test scores you want to enter :");
n = sc.nextInt();
//Getting the scores entered by the user
for (int i = 0; i < n; i++) {
System.out.print("Enter Test Score#" + (i + 1) + ":");
score = sc.nextInt();
//calling the method
System.out.println("Grade Letter :" + getLetterGrade(score));
//finding the highest score
if (highest < score)
highest = score;
//calculating the sum
sum += score;
}
//Displaying the output
System.out.println(" The Highest test score is :" + highest);
System.out.println("The Average is :" + ((double)(sum)) / n);
}
private static char getLetterGrade(int score) {
char gradeLetter = 0;
if (score >= 90 && score <= 100)
gradeLetter = 'A';
else if (score >= 80 && score < 90)
gradeLetter = 'B';
else if (score >= 70 && score < 80)
gradeLetter = 'C';
else if (score >= 60 && score < 70)
gradeLetter = 'D';
else if (score < 60)
gradeLetter = 'E';
return gradeLetter;
}
}
__________________
Output:
How many Test scores you want to enter :5
Enter Test Score#1:78
Grade Letter :C
Enter Test Score#2:89
Grade Letter :B
Enter Test Score#3:98
Grade Letter :A
Enter Test Score#4:87
Grade Letter :B
Enter Test Score#5:76
Grade Letter :C
The Highest test score is :98
The Average is :85.6
_____________Could you rate me well.Plz .Thank You
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.