Problem Requirement Specification The problem will solve a small piece of functi
ID: 3736218 • Letter: P
Question
Problem Requirement Specification The problem will solve a small piece of functionality that a future automatic grading system might want to implement The program will convert the numerical scores of a number of assignments provided by the user into percentages and letter grades. The grades are determined based on a prespe of each assignment cified scale. Printing the percentage a nd the Function Specification Simplifying Assumptions The program will be designed to accept a maximum number of 20 assignments The program will assume that all assignments will be graded out of the same maximum possible score. This maximum possible score will be provided by the user as described below 1. 2. .Program will obtain the number of assignments to be graded from the user The assignments from the user program will also obtain the maximum possible numeric score in the .The program will obtain the numeric score for each assignment from the .The program will calculate the percentages and then convert into a letter user grade based on a predetermined scale into letter grade: (A, B, C, D, or an F). +and- suffixes will not be allowed. Credits Carl Gelfand: Suffixes refers to when you get an A+, A B+, B-, and so on.Explanation / Answer
Code for banner function -
We are going to use Scanner class from java.util package to ask reader for keying in the input. The code for banner method is given below
public void banner(){
//create object of scanner class
Scanner reader = new Scanner(System.in);
System.out.println("Enter the number of assignments to be graded : ");
//we are asking user to input the number of assignments that program will grade
//nextInt() function checks the input from console and the value is stored in variable n
int n = reader.nextInt();
//it is important to close the Scanner object to free up the memory
reader.close();
}
Similarly we are going to implement getNumberOfAssignments method, the code is given below
public int getNumberOfAssignments(){
//create object of scanner class
Scanner reader = new Scanner(System.in);
System.out.println("Enter the number of assignments to be graded : ");
//we are asking user to input the number of assignments that program will grade
//nextInt() function checks the input from console and the value is stored in variable n
int n = reader.nextInt();
reader.close();
return n;
}
Code for getting maximum score
public double getMaximumScore(){
//create object of scanner class
Scanner reader = new Scanner(System.in);
System.out.println("Enter the maximum possible score in the assignments : ");
//we are asking user to input the maximum score for an assignment
//nextInt() function checks the input from console and the value is stored in variable n
double n = reader.nextDouble();
reader.close();
return n;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.