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

I need java code written for the following question and using the skeletons prov

ID: 3625521 • Letter: I

Question

I need java code written for the following question and using the skeletons provided at the end.

A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to each student, based on the average of his or her four test scores :
Score.....Letter Grade
90-100.....A
80-89.......B
70-79.......C
60-69.......D
0-59........F
Write a class that uses a String array or an ArrayList object to hold the five students' names, an array of five characters to hold the five student's letter grades, and five arrays of four doubles each to hold each student's set of test scores. The class should have methods that return specific student's name, average test score, and letter grade based on the average.

skeleton

/**

   GradeBook class

   Chapter 8, Programming Challenge 7

*/

 

public class GradeBook

{

   // Constant for the number of students

   private final int NUM_STUDENTS = 5;

  

   // Constant for the number of tests

   private final int NUM_TESTS = 4;

  

   // Array to hold student names

   private String[] names = new String[NUM_STUDENTS];

  

   // Array to hold student grades

   private char[] grades = new char[NUM_STUDENTS];

  

   // Create arrays of scores, one for each student.

   private double[] scores1 = new double[NUM_TESTS];

   private double[] scores2 = new double[NUM_TESTS];

   private double[] scores3 = new double[NUM_TESTS];

   private double[] scores4 = new double[NUM_TESTS];

   private double[] scores5 = new double[NUM_TESTS];

 

   /**

      The setName method assigns a student's name.

      @param studentNumber The student's number.

      @param name The student's name.

   */

  

   public void setName(int studentNumber, String name)

   {

      // your code

   }

  

   /**

      The setScores method copies an array of test scores

      to a student's array of scores.

      @param studentNumber The student's number.

      @param scores An array of test scores.

   */

  

   public void setScores(int studentNumber, double[] scores)

   {

               //your code

   }

  

   /**

      The getName method returns a student's name.

      @param studentNumber The specified student's number.

      @return The student's name.

   */

  

   public String getName(int studentNumber)

   {

            //your code

   }

  

   /**

      The getAverage method returns a student's average

      test score.

      @param studentNumber The specified student's number.

      @return The student's average test score.

   */

  

   public double getAverage(int studentNumber)

   {

            //your code

   }

  

   /**

      The getLetterGrade method returns a student's

      letter grade.

      @param studentNumber The specified student's number.

      @return The student's letter grade.

   */

  

   public char getLetterGrade(int studentNumber)

   {

            //your code

   }

 

   /**

      copyArray is a private method that copies the contents

      of one array to another.

      @param to The array to copy to.

      @param from The array to copy from.

   */

  

   private void copyArray(double[] to, double[] from)

   {

            //your code

   }

  

   /**

      calcAverage is a private method that calculates

      the average of the values in an array of test scores.

      @param scores The array with the test scores.

   */

  

   private double calcAverage(double[] scores)

   {

            //your code

   }

  

   /**

      assignGrade is a private method that determines and

      assigns a letter grade to a specific student.

      @param studentNumber The specified student's number.

   */

  

   private void assignGrade(int studentNumber)

   {

            //your code

   }

 

   /**

      determineGrade is a private method that determines

      a letter grade for a test average.

      @param average The test average.

      @return The letter grade.

   */

  

   private char determineGrade(double average)

   {

            //your code

   }

}


Explanation / Answer


import java.util.Scanner;


public class GradeBookTest {

public static void main(String[] args)
{
GradeBook GB = new GradeBook();
System.out.println("STUDENT DATA");
getData(GB);

for(int i=1; i<6; i++)
       {
System.out.println(GB.getName(i) + " Has got Average "+ GB.getAverage(i) + " and Grade is " + GB.determineGrade(GB.getAverage(i)) );
       }

}

public static void getData(GradeBook GB)
{
String name; // To hold a name
double[] scores = new double[4]; // An array of scores
Scanner keyboard = new Scanner(System.in);
    for (int student = 1; student <= 5; student++)
    {
        System.out.println("Please Enter Student Name " + student + " :");
           name = keyboard.next();
           GB.setName(student, name);
           for(int j=1; j<5; j++)
           {
               System.out.println("Please Enter Student " + student + " subject " + j +" marks :");
               scores[j-1] = keyboard.nextDouble();
               while(scores[j-1]<0 || scores[j-1]>100)
               {
                   System.out.println("Invalid Marks Entered Plz Enter Marks in range (0 - 100) ");
                   System.out.println("Please ReEnter Student " + student + " subject " + j +" marks :");
                   scores[j-1] = keyboard.nextDouble();
               }
           }
            GB.setScores(student, scores);
}
System.out.println();
}
}