Question: Write a Java program to determine a student's grade. It reads three test scores (between 0 and 100) and calculates the average score and converts

Write a Java program to determine a student's grade. It reads three test scores (between 0 and 100) and calculates the average score and converts it to a letter grade.

Average Score Calculation: Average Score = (Test Score 1 + Test Score 2 + Test Scores 3) /3.0

Grade Conversion Rules: Rule a. If the average score is 90 or more the grade is 'A'.

Rule b. If the average score is 70 or more and less than 90 then check the third test score. If the third score is 90 or more the grade is 'A' otherwise the grade is 'B'.

Rule c. If the average score is 50 or more and less than 70 then check the average of the second and third scores. If the average of the last two is 70 or more, the grade is 'C' otherwise it is a 'D'

Rule d. If the average score is less than 50 then the grade is 'F'.

Rounding Rule: Midpoint Rounding Calculate the grade average as a double. Round up to the next int if the fractional part is .5 or greater, otherwise truncate the fraction by casting to an int. The algorithm is: Add .5 to the average and cast the result to an int. Example: average = (int)(average+0.5);

Create a new project in NetBeans or any Java IDE, name it FirstName_LastName_A3 where FirstName is your first name and LastName is your last name. Submit your zipped project folder in Eagle Online Canvas for grading.

To solve this problem, we can identify IPO and develop the Pseudocode.

1. Input: three test scores

2. Processing: Calculate the average and convert it to letter grade according to the three conversion rules.

3. Output: Display the letter grade

4. Variables: int test1, test2, test2 double average, average2 char letterGrade

5. Constants: none

Detailed Pseudocode:

1. Prompt user to enter first test score

2. Read user input and store value into variable test1

3. Prompt user to enter second test score

4. Read user input and store value into the variable test2

5. Prompt user to enter third test score

6. Read user input and store value into the variable test3

7. average = (test1 + test2 + test3) / 3.0

average = (int) (average +0.5) //apply rounding rule

8. average2 = (test2+test3) / 2.0

average2 = (int) (average2+0.5) //apply rounding rule

9. if (average >=90)

letterGrade=A

else if (average >=70)

if (test3 >= 90)

letterGrade=A

else

letterGrade=B

else if (average >=50)

if (average2>=70)

letterGrade=C

else

letterGrade=D

else

letterGrade=F

10. Display letterGrade

Once the above detailed pseudocode is developed, you can map it line by line into Java code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!