title: Trouble splitting data in Java program
body: <p>I'm trying to split my variables and enter my student data in so I can move on with my grade calculation program, but my second time splitting the entered string, there is a problem and I cannot figure out what is the cause of it.</p>
  
  <p>Users will enter information in that looks like this
  John Denver: e100 q70 q50 h100 e100 e90 h80 q60 h100</p>
  
  <p>The program needs to split apart all of this data and get the name entered into an array, and then the exam scores, quiz scores and homework scores represented by the "e", "q" or "h" in the entered data.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class GradeCalcWithArrays { /*
                                   * Daniel The purpose is to calculate
                                   * entered grades
                                   */
  public static void main(String[] args) {
  
      Scanner s = new Scanner(System.in);
  
      boolean done = false;
      boolean quit = false;
      int choice = 0;
      int maxstudents = 200;
  
      int[] examstats = new int[3]; /*
                                   * Array created to store the information
                                   * entered for exams
                                   */
      int[] quizstats = new int[3]; /*
                                   * Array created to store the information
                                   * entered for quizzes
                                   */
      int[] homeworkstats = new int[3]; /*
                                       * Array created to store the
                                       * information entered for homework
                                       */
  
      String[] studentnames = new String[maxstudents]; /*
                                                       * Array created to
                                                       * store the student
                                                       * name information
                                                       * entered
                                                       */
  
      System.out.println("Welcome to GradeBook!");
      System.out.println("Please provide grade item details");
  
      System.out.print("Exams    (number, points, weight):");
  
      examstats[0] = s.nextInt(); // inputs exam number
      examstats[1] = s.nextInt(); // inputs exam points
      examstats[2] = s.nextInt(); // inputs exam weight
  
      System.out.print("Quizzes     (number, points, weight):");
  
      quizstats[0] = s.nextInt(); // inputs quiz number
      quizstats[1] = s.nextInt(); // inputs quiz points
      quizstats[2] = s.nextInt(); // inputs quiz weight
  
      System.out.print("Homework    (number, points, weight):");
  
      homeworkstats[0] = s.nextInt(); // inputs homework number
      homeworkstats[1] = s.nextInt(); // inputs homework points
      homeworkstats[2] = s.nextInt(); // inputs homework weight
  
      double[] examscores = new double[examstats[0]];
      double[] quizscores = new double[quizstats[0]];
      double[] hwscores = new double[homeworkstats[0]];
  
      System.out.println("--------------------");
  
      do {
          System.out.println("What would you like to do?");
          System.out.println("    1 Add student data");
          System.out.println("    2 Display student grades &amp; statistics");
          System.out.println("    3 Plot grade distribution");
          System.out.println("    4 Quit");
          System.out.print("Your choice:");
          choice = s.nextInt(); /*
                               * Choice will determine what the next course of
                               * action will be with the program
                               */
  
          if (choice == 1) {
              System.out.println("Enter student data:");
  
              for (int i = 0; i &lt;= maxstudents; i++) {
                  System.out.print("Data&gt;");
                  String dataentry = s.nextLine();
  
                  String[] firstsplit = dataentry.split(":");
                  studentnames[i] = firstsplit[0];
                  String[] secondsplit = firstsplit[1].split(" ");
  
                  for (int j = 0; j &lt;= maxstudents; j++) {
  
                      String c;
  
                      c = secondsplit[j].substring(0, 1);
  
                      if (c == "e") {
                          secondsplit = secondsplit[j].split("e");
                          examscores[i] = Double.parseDouble(secondsplit[j]);
  
                      }
                      if (c == "q") {
                          secondsplit = secondsplit[j].split("q");
                          quizscores[i] = Double.parseDouble(secondsplit[j]);
  
                      }
                      if (c == "h") {
                          secondsplit = secondsplit[j].split("h");
                          hwscores[i] = Double.parseDouble(secondsplit[j]);
  
                      }
  
                      if (dataentry.equals("done")) {
                          break;
                      }
                  }
              }
          }
  
          if (choice == 2) {
  
          }
  
          if (choice == 3) {
  
          }
  
          if (choice == 4) {
              quit = true;
              System.out.println("Good bye!");
          }
  
      } while (quit == false);
  
  }
  
  }
  </code></pre>
  
  <p>I get an error that says: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
      at GradeCalcWithArrays.main(GradeCalcWithArrays.java:83)</p>
  
  <p>Can someone help me fix this and tell me if my program is going to work?</p>