title: GradeBook Java Program. Help calling class?
body: <p>The assignment goes as follows.</p>
  
  <p>A teacher has five students who have taken four tests. The teacher uses the following grade scale to assign a letter grade to a student, based on the average of his or her four test scores.</p>
  
  <pre><code>90-100:  A
  80-79:  B
  70-79:  C
  60-69:  D
  0-59:  F
  </code></pre>
  
  <p>Write a class that uses a String array on an arraylist object to hold the five students' names, an array of five characters to hold the five students' 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 a student's name, the average test score, and a letter grade based on the average.</p>
  
  <p>Demonstrate the class in a program that allows the user to enter each student's name and his or her four test scores. It should then display each student's average test score and letter grade.</p>
  
  <p>Program should not accept a score lower than 0 or higher than 100</p>
  
  <p><strong>The following code is here:</strong></p>
  
  <p>Student class:</p>
  
  <pre><code>public class Student{
      private String name;
      private double[] test = new double[4];
  
  
      public Student(){
          name = " ";
      }
  
      public Student(String n, double[] t){
          name = n;
          test = t;
      }
  
      public void setName(String n)
      {
          name = n;
      }
  
      public String getName(){
          return name;
      }
  
      public void setTest(double t,int i)
      {
          test[i] = t;
      }
  
      public double getTest(int i)
      {
          return test[i];
      }
  
  
      public double getTestAvg(){
  
          double sum = 0;
          double avg;
          for(int i = 0; i &lt; test.length; i++)
          {
              sum += test[i];
          }
           avg = sum / test.length;
           return avg;
      }
  
      public char getLetterGrade(){
  
          double average = getTestAvg();
          char grade=0;
  
          if(average &gt;= 90)
              grade = 'A';
          else if (average &gt;= 80)
              grade = 'B';
          else if (average &gt;= 70)
              grade = 'C';
          else if (average &gt;=60)
              grade = 'D';
          else if (average &lt; 60)
              grade = 'F';
  
          return grade;
      }
  
      public String toString(){
          String str = "";
          str += "\nName of student: " + name;
          str += "\nAverage test score: " + getTestAvg();
          str += "\nLetter grade: " + getLetterGrade();
          return str;
      }
  }       
  </code></pre>
  
  <p>The Main Program:</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.*;
  
  public class GradeBook {
  
      public static void main(String[] args) throws IOException {
  
          Student[] students = new Student[5];
  
          getStudentData(students);
  
      }
  
      public static double getStudentData(Student[] array) {
          Scanner scan = new Scanner(System.in);
          String[] student = new String[5];
          double[] test = new double[4];
          for (int i = 0; i &lt; student.length; i++) {
              System.out.println("Enter the name of the student : ");
              student[i] = scan.nextLine();
              for (int j = 0; j &lt; test.length; j++) {
                  System.out.println("Enter score " + (j + 1) + " for the student");
                  test[j] = scan.nextDouble();
                  scan.nextLine();
              }
              array[i] = new Student(student[i], test);
  
          }
          return 0;
  
      }
  }
  </code></pre>
  
  <p>The problem is, is that I can enter all the information, but nothing will display after all the numbers have been entered in. Any help would be greatly appreciated!</p>