Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In java: Write a grading program for an instructor who course as the following p

ID: 3723923 • Letter: I

Question

In java:

Write a grading program for an instructor who course as the following policies:

Two quizzes, each graded on the basis of 10 points, are given.

One midterm and one final exam, each graded on the 100 points, are given.

The final exam counts for 50 percent of the grade, the midterm counts for 25 percent, and the two quizzes together count for a total of 25. (Do not forget to normalize the quiz scores. They should be converted to percentages before they are averaged in.)

Any grade of 90 percent or more is an A, any grade between 80 and 89 percent is a B, any grade between 70 and 79 percent is a C, any grade an F.

The program should read in the student’s scores and display the student’s record, which consists of two quiz scores, two exam scores, the student’s total score for the entire course, and the final letter grade. The total score is a number in the range 0 to 100, which represents the weighted average of the student’s work.

Define and use a class for the student record. The class should have instance variables for the quizzes, midterm, final, total score for the course, and final letter grade. The class should have input and output methods. The input method should not ask for the final numeric grade, nor should it ask for the final letter grade. The class should have methods to compute the overall numeric grade and the final letter grade. These last two methods will be void methods that set the appropriate instance variables. Remember, one method can call another method. If you prefer, you can define a single method that sets both the overall numeric score and the final letter grade, but if you do this, use a helping method. Your program should use all the methods described here. Your class should have a reasonable set of accessor and mutator methods, whether or not your program uses them. You may add other methods if you wish.

Explanation / Answer

Note : Could you please check the output .If you required any changes Just intimate.I will modify it.Thank You.

_______________

GradeCalculator.java

import java.util.Scanner;

public class GradeCalculator {

//Declaring instance variables

private int quiz1;

private int quiz2;

private int midTerm;

private int finalExam;

private double totalScore;

private char finalGradeLetter;

//Zero argumented constructor

public GradeCalculator() {

}

// getters and setters

public int getQuiz1() {

return quiz1;

}

public void setQuiz1(int quiz1) {

this.quiz1 = quiz1;

}

public int getQuiz2() {

return quiz2;

}

public void setQuiz2(int quiz2) {

this.quiz2 = quiz2;

}

public int getMidTerm() {

return midTerm;

}

public void setMidTerm(int midTerm) {

this.midTerm = midTerm;

}

public int getFinalExam() {

return finalExam;

}

public void setFinalExam(int finalExam) {

this.finalExam = finalExam;

}

public void readInput()

{

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

System.out.print("Enter the score in Quiz#1:");

quiz1=sc.nextInt();

System.out.print("Enter the score in Quiz#2:");

quiz2=sc.nextInt();

System.out.print("Enter the score in MidTerm:");

midTerm=sc.nextInt();

System.out.print("Enter the score in Final Exam:");

finalExam=sc.nextInt();

calculateFinalScore();

calculateGradeLetter();

}

public void calculateFinalScore()

{

totalScore =(quiz1/ 10.*100. + quiz2 / 10.*100.) / 2.*.25 + midTerm*.25 + finalExam*.5;

}

public void calculateGradeLetter()

{

if (totalScore >= 90)

finalGradeLetter = 'A';

else if (totalScore >= 80 && totalScore < 90)

finalGradeLetter = 'B';

else if (totalScore >= 70 && totalScore < 80)

finalGradeLetter = 'C';

else if (totalScore >= 60 && totalScore < 70)

finalGradeLetter = 'D';

else if (totalScore < 60)

finalGradeLetter = 'E';

}

  

public void displayResults()

{

System.out.println("Overall Score :"+totalScore);

System.out.println("Final Letter Grade :"+finalGradeLetter);

  

}

}

_________________

Test.java

public class Test {

public static void main(String[] args) {

  

//Creating an instance of GradeCalculator

GradeCalculator gc=new GradeCalculator();

//calling the methods on the class object

gc.readInput();

gc.displayResults();

}

}

__________________

Output

Enter the score in Quiz#1:10
Enter the score in Quiz#2:9
Enter the score in MidTerm:88
Enter the score in Final Exam:92
Overall Score :91.75
Final Letter Grade :A

______________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote