title: Reorder the String
body: <p>The following code does works but producing as
  Bob Mary Geoff
  82 65 23</p>
  <p>What can I change to reorder the String to make it looks like
  Bob 82 \n
  Mary 65 \n
  Geoff 23</p>
  <p>Furthermore, I want to set a range for each grade, for example, grade over 85 is&quot;HD&quot;, 85-75 is &quot;D&quot;, 74 -65 is &quot;C&quot;, 64 -55 is &quot;P&quot;, 54- 0 is &quot;F&quot;.
  So instead of giving Bob, Mary and Geoff a actual grade, it gives them an interval. For example: Bob D, Mary C, Geoff F.</p>
  <pre><code>public class Student {
      String[] names;
      int[] grades;
      
      public Student(int numStudents) {
          this.names = new String[numStudents];
          this.grades = new int[numStudents];
      }
      
      public void addStudent(String name, int grade) {
          int i = 0;
          while (i &lt; this.names.length &amp;&amp; names[i] != null) {
              i++;
          }
          if (i &lt; names.length) {
              names[i] = name;
              grades[i] = grade;
          }
      }
      public String toString() {
          String result = &quot;&quot;;
          for (int i=0; i &lt; this.names.length; i ++) {
              result += this.names[i] + &quot; &quot;;
  
          }
          result += &quot;\n&quot;;
          for (int i = 0; i&lt; this.grades.length; i++) {
              result += this.grades[i] + &quot; &quot;;
  
  
          }
          return result;
      }
      public static void main(String[] args) {
          
          Student classRoom  = new Student(3);
          classRoom.addStudent(&quot;Bob&quot;, 82);
          classRoom.addStudent(&quot;Mary&quot;, 65);
          classRoom.addStudent(&quot;Geoff&quot;, 23);
  
          System.out.println(classRoom);
      }
  </code></pre>