Share
Explore BrainMass

Java Sample Program: Grading Application

I need some help with writing a program.

Your program should output a title similar to "Welcome to Ken's Grading Program", using your own name of course.

Your program should prompt the user if they will be entering numbers or letters for grades. See example below.

If the user enters 'numbers':
Get input for the grade number in decimal format. i.e. 74.22645 (enter it with 5 decimal places)
Utilize the Math class and round the number to zero decimal places, then use the int cast method to convert to an integer.(ensure you round it before type casting it)
Utilize a switch statement to determine the corresponding letter grade. Use the grading criteria from this course for the numbers. (ensure you accept all allowable numbers i.e. 70-79 and all in between)
Output the corresponding letter grade along with the initial number entered in decimal format utilizing the printf method and format specifiers. Output the number in only 3 decimal places.

If the user enters 'letters':
Get input for the grade letter in String format.
Utilize a switch statement to determine the corresponding output for the letter entered. (ensure you accept both upper and lower case letters.
Use the grading criteria from this course for the numbers. (you must use charAt( ) so the string will work with your switch)
Output the corresponding numbers values for the letter entered along with the letter initially entered.
Example Output:

If numbers was entered
Welcome to Grading Pro
Will you be entering numbers or letters?
Enter 'numbers' or 'letters'
numbers
Enter a number in the format 74.22645
74.22645
C - 74.226
Press any key to continue . . .

if letters was entered
Welcome to Grading Pro
Will you be entering numbers or letters?
Enter 'numbers' or 'letters'
letters
Enter a letter in String format
C
70-79 - C
Press any key to continue . . .

Options:
This requests you to obtain a double number from the user and then round it and/or type cast it into an integer. This integer number is later used in a switch to determine the letter grade. If you follow these instructions and you find satisfactory results, all the best for you.
If on the other hand, you find out that the best way for you to provide a letter grade is using a set of if-else statements instead.

Solution Summary

This response provides guidelines to create a Java program that allows the user to enter letter and numbers for grades.

$2.19