title: (JAVA) I need help creating a class with getters and setters, creating a class with an array and then calling upon the other class.
body: <p>This is my objective--
  you have to create 2 classes:
   1. Student class
        Attributes
  Create a Student class with 3 attributes(instance variables), including
  ◦     name (String)
  ◦     midterm (double)
  ◦     finalExam (double)
   Methods
  Define setters/getters for each attributes. Therefore, you have to create 3 setters and 3 getters in total.
  In the setters of midterm and finalExam, you have to check whether the given grade is valid. The grade has to be between 0-100. If it is invalid, print out an error message “The grade is invalid!”
  Define a method, getFinalGrade, which calculates the final grade according to the following grading scheme. After the computation, return the result of final grade.
  ◦     Grading:
  ▪     Midterm:        40%
  ▪     Final exam:    60%
  Define a method, showGrades, which outputs the details of attributes. The grades should be displayed as a number with two decimal places only. (See the example)
  ◦     Output example: “Name: Tom, Midterm: 90.00, Final Exam: 80.00, Final Grade: 82.00” </p>
  
  <ol>
  <li>GradeCalculator class
  Create a GradeCalculator class and put everything (Step 1 to Step 4) in the main method.
  Step 1: create a Student array, called studentArray, whose length is 5.
  Step 2: create 5 Student objects by using loop. Ask the user to input name, midterm, final exam one at a time (prompt the user) and store these in corresponding attributes by calling the appropriate setters. After all values are set, store the newly-created Student object to studentArray.
  Step 3: loop studentArray to print out the details of each student by calling showGrades.
  Step 4: calculate the average final grade of these 5 student and print it out on the screen. The grades should be displayed as a number with two decimal places only. </li>
  </ol>
  
  <p>Here is the code I have written thus far:</p>
  
  <pre><code>public class Student {
  
  private String name;
  private double midterm;
  private double finalExam;
  private double finalGrade;
  
  public Student(String n, double a, double m)
  {
      name = n;
      midterm = a;
      finalExam = m;
  }
  
  
  public String getName()
  {
      return (name);
  }
  public double getmidterm()
  {
      return (midterm);
  }
  
  if (midterm &lt; 0)
  {
  midterm = 0;
  System.out.println("The grade is invalid! Grade will be entered as 0.");
  }
  if (midterm &gt;100)
  {
  midterm = 100;
  System.out.println("The grade is invalid! Grade will be entered as 100.");
  }
  else
  {
  System.out.println("Midterm grade recorded." + midterm);
  }
  public double getfinalExam()
  {
      return (finalExam);
  }
  
  if (finalExam &lt; 0)
  {
      finalExam = 0;
      System.out.println("The grade is invalid");
  }
  if (finalExam &gt; 100)
  {
      finalExam = 100;}
      System.out.println("The grade is invalid! Grade will be entered as 100.");
  }
  else
  {
      System.out.println("Final Exam grade recorded." + finalExam);
  }
  public double getfinalGrade()
  {
  finalGrade = (midterm * .40) + (finalExam * .60);
      return (finalGrade);
  }
  public double showGrades()
  {
  System.out.println("Name:" + name + "midterm:" + midterm + "Final Exam:"  + finalExam);
  }
  public void setName(String studentName) 
  {
      name = studentName;
  }
  public void setMidterm(double midtermGrade)
  {
      midtermGrade = midterm;
  }
  public void setFinal(double finalGrade)
  {
      finalGrade = finalExam;
  }
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>public class GradeStudents{
  Student[] students;
  import java.util.Scanner;
  
  GradeStudents(){}
  
  public static void main(String[] args)  {
  
  String[] studentarr = new String[5];
  
  for(double i = 0; i &lt; 5; i++);
      { //insert what the for loop executes here}
  }
  
  
  }
  
  }
  </code></pre>