title: How to design a program that does not make parallel arrays
body: <p>I am working on an assignment in my Java textbook that says:</p>
  
  <blockquote>
    <p>Modify the GradeRange program (Listing 6.5) from this chapter so that it doesn't use parallel arrays. Instead, design a new class called Grade that stores both the grade string and its cutoff value (the lowest score for that grade). Set both values using the Grade constructor and provide methods that return the values. In the main method of the new GradeRange program, fill a single array with Grade objects, and then produce the same output as the original GradeRange program did.</p>
  </blockquote>
  
  <p>Here is the GradeRange program:</p>
  
  <pre><code>//********************************************************************
  //  GradeRange.java       Author: Lewis/Loftus/Cocking
  //
  //  Demonstrates the use of an array of String objects.
  //********************************************************************
  
  public class GradeRange
  {
     //-----------------------------------------------------------------
     //  Stores the possible grades and their numeric lowest value,
     //  then prints them out.
     //-----------------------------------------------------------------
  
  
  
   public static void main (String[] args)
     {
    String[] grades = {"A", "A-", "B+", "B", "B-", "C+", "C", "C-",
                       "D+", "D", "D-", "F"};
  
    int[] cutoff = {95, 90, 87, 83, 80, 77, 73, 70, 67, 63, 60, 0};
  
    for (int level = 0; level &lt; cutoff.length; level++)
       System.out.println (grades[level] + "\t" + cutoff[level]);
  
  
  }
  }
  </code></pre>
  
  <p>I don't understand in the question when it says: </p>
  
  <blockquote>
    <p>...stores both the grade string and its cutoff value... Set both values using the Grade constructor...</p>
  </blockquote>
  
  <p>Here is my start of the class:</p>
  
  <pre><code>public class Grade
  {
  public Grade (String[] grades, int[] cutoff)
  {
  </code></pre>
  
  <p>I don't know how I would store the grade string and cutoff into the constructor if that is what the assignment is asking. I also don't know what an array that is not parallel would look like. I guess my final questions is how would I develop the program (what methods to make...)? And what is the question asking when it says </p>
  
  <blockquote>
    <p>fill a single array with Grade objects</p>
  </blockquote>
  
  <p>OUTPUT:</p>
  
  <pre><code>A   95
  A-  90
  B+  87
  B   83
  B-  80
  C+  77
  C   73
  C-  70
  D+  67
  D   63
  D-  60
  F   0
  </code></pre>