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

Program Description ( JAVA ) In this assignment, you will develop a Console base

ID: 3667476 • Letter: P

Question


Program Description ( JAVA )
In this assignment, you will develop a Console based Grading application. This application will calculate the grade of 11 students based on their scores in exams and homework. It will also calculate the maximum of the exam and homework scores.
Operation
The application does the following:
1. generates random exam score in the range [0, 200] for 11 students and stores it in an array of doubles. See the Implementation Details below for information about how to generate random numbers in Java.
2. generates random homework scores in the range [0,100] for 11 students and stores it in an array of doubles.
3. computes the total score of each student based on the following formula:
totalScore = (75 x exam/ 200) + (25 x hw/ 100)
4. determines the grade the student earns given the following grading scheme. The grading scheme is: A: >= 80, B: [60, 80), C: < 60. Note that B:[60, 80) means a student gets a B if his score is >= 60, but strictly less than 80.
5. displays the students’ exam, homework, total scores and grade on the screen in the same format as shown in the sample output below.
6. calculates the maximum of all exam scores, the maximum of all homework scores and the maximum of all total scores and displays them in the format shown in the sample output below.
Implementation Details
To implement this application you will use arrays and functions.
All variables/arrays must be declared inside some function (note that main() is also a function).
You will write at least the following functions to accomplish the task of the application. You may write other functions to accomplish other subtasks of the application, if you like.
1. computeGrade: it will compute and return the grade of one student
2. computeMax: it will take one array of doubles as input, compute the maximum of the numbers in the array and return the computed maximum.
The following code will generate 2 random integers in the range 0 to 10
java.util.Random r = new java.util.Random( ); // this line must appear only once
// in your code and must be added
// before the loop(s) that is used to
// generate the random numbers.
int n1 = r.nextInt(11); // generates a random number between 0 and 10
// and stores in variable n1
int n2 = r.nextInt(11); // generates another random number between 0 and 10
// and stores in variable n1
Sample Output
Exam HW Total Grade
116 86 65.00 B
142 91 76.00 B
3 91 23.88 C
54 55 34.00 C
92 16 38.50 C
166 23 68.00 B
156 89 80.75 A
173 76 83.88 A
47 21 22.88 C
8 0 3.00 C
181 2 68.38 B


Exam Max: 181
HW Max: 91
Total Max: 83.88

Explanation / Answer

Grading.java

package com.chegg.test;

import java.util.Random;

public class Grading {

   public static void main(String[] args) {
       Random r = new Random();
       double totalScore = 0;
       String grade = "";
       double max = 0;
       double[] examScore = new double[11];
       double[] homeWorkScore = new double[11];
       double[] total = new double[11];

       for (int i = 0; i < 11; i++) {
           examScore[i] = r.nextInt(200);
       }

       for (int i = 0; i < 11; i++) {
           homeWorkScore[i] = r.nextInt(100);
       }

       System.out.println("Exam HW Total Grade");
       for (int i = 0; i < 11; i++) {
           totalScore = (75 * examScore[i] / 200)
                   + (25 * homeWorkScore[i] / 100);
           total[i] = totalScore;
           grade = computeGrade(totalScore);

           System.out.println(examScore[i] + " " + homeWorkScore[i] + " "
                   + totalScore + " " + grade);
       }
       System.out.println();
       max = computeMax(examScore);
       System.out.println("Exam Max:" + max);
       max = computeMax(homeWorkScore);
       System.out.println("HW Max:" + max);
       max = computeMax(total);
       System.out.println("Total Max:" + max);
   }

   private static double computeMax(double[] examScore) {
       double largest = Integer.MIN_VALUE;

       for (int i = 0; i < examScore.length; i++) {
           if (examScore[i] > largest) {
               largest = examScore[i];
           }
       }
       return largest;
   }

   private static String computeGrade(double totalScore) {
       if (totalScore >= 80) {
           return "A";
       } else if (totalScore >= 60 && totalScore < 80) {
           return "B";
       } else {
           return "C";
       }
   }

}

Output:

Exam   HW   Total   Grade
70.0   16.0   30.25   B
182.0   36.0   77.25   B
126.0   35.0   56.0   B
186.0   0.0   69.75   B
7.0   23.0   8.375   B
185.0   88.0   91.375   A
29.0   95.0   34.625   B
120.0   71.0   62.75   B
193.0   69.0   89.625   A
175.0   20.0   70.625   B
92.0   94.0   58.0   B

Exam Max:193.0
HW Max:95.0
Total Max:91.375

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