Explore BrainMass
Share

Java Sample Program: Grading Application

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

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.

© BrainMass Inc. brainmass.com October 24, 2018, 11:42 pm ad1c9bdddf
https://brainmass.com/computer-science/operating-systems/java-sample-program-grading-application-202451

Solution Summary

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

$2.19
See Also This Related BrainMass Solution

Write a java application that accomplishes the following tasks

Write a java application that accomplishes the following tasks (similar to the program assignment we did in CSC212 yet with built in exception handling):

1) Ask the number of homework assignment students have submitted in a semester

2) Calculate the letter grade the student has earned based on the average of these assignments.

Note:

1) Assume the full score for each assignment is 100. Student will get 0 for each unsubmitted assignment.

2) Student's letter grade is based on the average of all their assignments

90 -- 100 A

80 -- 89 B

70 -- 79 C

60 -- 69 D

0 -- 60 F

3) The program needs to have built in Exception handling.

After you are done, zip the source file along with screen shot of the output and send

View Full Posting Details