Program: Write a program that translates a number into the closest letter grade. For case, the number 2.8 which might have been the average of several grades would be converted to B-.
Break ties in favor of the better grade; for case, 2.85 should be a B. Any value ?4.15 should be an A+.
Use a class Grade with a method getLetterGrade.
Here is a sample program run:
Enter a numeric value:
2.85
Letter grade: B
Use the subsequent class as your main class:
import java.util.Scanner;
/**
This class prints the letter grade corresponding to a numeric value given by the user.
*/
public class GradePrinter
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Enter a numeric value:");
double numGrade = in.nextDouble();
Grade g = new Grade(numGrade);
System.out.println("Letter grade: " + g.getLetterGrade());
}
}
You need to supply the subsequent class in your solution. Can someone demonstrate me how to write a proper code for this problem and how to complete it. Thanks