In: Computer Science
Please use the Java Programming language. This is the introductory course, chapter two. Please only use if/else if, else and while loop. We have not touch base with do and while do(I don't know if while do exist in Java).
Create an application that converts number grades to letter grades.
Console
Welcome to the Letter Grade Converter
Enter numerical grade: 90
Letter grade: A
Continue? (y/n): y
Enter numerical grade: 88
Letter grade: A
Continue? (y/n): y
Enter numerical grade: 80
Letter grade: B
Continue? (y/n): y
Enter numerical grade: 67
Letter grade: C
Continue? (y/n): y
Enter numerical grade: 59
Letter grade: F Continue? (y/n): n
Specifications • The grading criteria is as follows: A 88-100 B 80-87 C 67-79 D 60-67 F <60 • Assume that the user will enter valid integers between 1 and 100 for the grades. • The application should continue only if the user enters “y” or “Y” to continue.
//LetterGradeConverter.java import java.util.Scanner; public class LetterGradeConverter { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); System.out.println("Welcome to the Letter Grade Converter"); String choice = "y"; while(choice.equals("y")) { System.out.print("Enter numerical grade: "); double grade = scnr.nextDouble(); String output; if(grade >= 88){ output = "A"; } else if(grade >= 80){ output = "B"; } else if(grade >= 67){ output = "C"; } else if(grade >= 60){ output = "D"; } else { output = "F"; } System.out.println("Letter grade: " + output); System.out.print("Continue? (y/n): "); choice = scnr.next(); } } }