Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me make a JAVA code called Grading that will have three public static methods? A getScaledScore method: This method takes two parameters:
Can someone help me make a JAVA code called Grading that will have three public static methods?
- AgetScaledScoremethod: This method takes two parameters: and integer parameter and a Scanner parameter. The integer parameter represents the maximum number of points for an assignment (used for scaling purposes). The Scanner parameter (see below for more information) is used to prompt the instructor to enter a student's score, which will be an integer. The entered score is then scaled to an integer score in the 0 to 100 range (i.e., the percentage is calculated), and the integer scaled score returned.
A few rules:
- Negative scaled scores are set to 0
- Scaled scores above 100 are set to 100
- If the scaling process yields a number that is not an integer, that number is rounded up. For example, if the method argument is 700 (= max possible points) and the instructor enters 628, the raw scaled score is 89.71429, which must be rounded UP to 90. Hint: To round a number up, you can use theMath.ceil()method but be careful; this method returns a double.
- AcalculateGrademethod: This method takes an integer parameter, which represents a scaled score, or equivalently a percentage from 1 to 100, and returns a character, which represents the corresponding letter grade based onA >= 90B >= 80C >= 70D >= 60F < 60
- AgetGrademethod, which combines the above two methods. ThegetGrademethod has two parameters: the first is an integer representing the maximum possible points for the exam/assignment. The second is a Scanner instance. The method prompts the instructor to enter a student's score, and it returns the corresponding letter grade.
Main method example:
`public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println(getScaledScore(60, scan));
System.out.println("Grade is " + getGrade(25, scan)); // This calls getScaledScore internally
scan.close();
}`
Hints:
- Watch out for integer division.
- Both thegetScaledScoreandgetGrademethods should prompt the user to enter a score using their parameter Scanner instance.
Grading Code
public class Grading {
// Code your three methods (and, optionally, a main method for testing) here
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started