Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The followings are the rules of calculating the average and letter grade. Average Score Calculation: Average Score = (Test Score 1 + Test Score 2

The followings are the rules of calculating the average and letter grade.

Average Score Calculation:

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

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);

Methods required in the project:

gradesInput() Get test score from the user and return a test score to the calling method. You can call this method 3 times to get 3 test scores.

average3Scores(int s1, int s2, int s3)Average three test scores and apply the rounding rule and return the average.You pass three test scores in the parameter list in this method.

averageLast2

Scores(int s2, ints3)Average last 2 test scores and apply the rounding ruleand return theaverage. You pass two test scores in the parameter list in this method.

toLetterGrade(double avg, double avg2, int s3)Convert average grade to letter grade according the grade conversion rules and return the letter grade. You pass average, average2 and test 3 in this method.

displayGrade(double avg, char lGrade)Display average grade and letter grade, and do not return anything.You pass averge and letter grade in your parameter list in this method.

Here are the layout for each method

public static int gradesInput()

{

//Declare an int variable to store test score

//Create new Scanner object

//Prompt user to enter the test score

//Read the test score and store it into a variable

//Validate the test input to make sure it is between 0 and 100

//return test score

}

public static double average3Scores(int s1, int s2, int s3)

{

//Declare a double variable to hold average

//Calculate average by adding three scores (s1, s2, and s3) and divided it by 3.0

//Apply rounding rule

//return averge

}

public static double average2Scores(int s2, int s3)

{

//Declare a double variable to hold average of 2 test scores

//Calculate average by adding two test scores (s2 and s3) and divided it by 2.0

//Apply rounding rule

//return averge

}

public static char toLetterGrade(double avg, double avg2 ,int s3)

{

//Declare a letter grade variable

//Apply grade conversion rule using if.. else if statement

//return letter grade

}

public static void displayGrade(double avg, char lGrade)

{

//Display average of 3 test scores (avg)

//Display letter grade (lGrade)

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

understand the importance and basic principles of estimation.

Answered: 1 week ago

Question

List the characteristics of an effective HR strategy.

Answered: 1 week ago

Question

KEY QUESTION Refer to columns 1 and 6 in the table for question

Answered: 1 week ago