Code in Java using Eclipse
Using a switch statement and a do-while loop, write a program/class (called PercentageToGradeConverter) to repeatedly accept a percentage from the user and output the corresponding College grade. The program should terminate once "quit" is entered. Invalid input and numbers should be handled appropriately. Grades are based on rounded percentages as follows: I (70+), II.1 (60-69), II.2 (50-59), III (40-49), F1 (35-39), F2 (0-34). Note that you must use the input & output text as shown in the sample expected input/output (for automatic testing purposes).
Sample expected input/output (user input in green):
Enter a percentage (or 'quit' to finish):
65.0
The grade for 65.0% is a II.1
Enter a percentage (or 'quit' to finish):
78.9
The grade for 78.9% is a I
Enter a percentage (or 'quit' to finish):
37.38
The grade for 37.38% is an F1
Enter a percentage (or 'quit' to finish):
31
The grade for 31.0% is an F2
Enter a percentage (or 'quit' to finish):
43
The grade for 43.0% is a III
Enter a percentage (or 'quit' to finish):
50.3
The grade for 50.3% is a II.2
Enter a percentage (or 'quit' to finish):
quit