I am teaching myself Java right now and a friend of mine gave me what he calls a good "Training" program to develop. It is a console based app which needs to meet the following criteria:

1) Read in a text document called Records
a. The document will contain 10 lines of data organized like
1. First Name, Last Name, GPA
2) Display the contents of the file on the console with a column header for each category and each columns should be aligned.
3) Then just wait for user input
4) Then display the contents of the file alphabetized by last name while keeping alignment
5) Then just wait for user input
6) Then display the contents of the file arranged by GPA from highest to lowest while keeping alignment
7) Wait for user input before close

Below is what I have managed to come up with by looking online and adding what I already know. As you can see I am able to read in the file and display the contents, I am even able to alphabetize it (I don't know how to wait for user input before it alphabetizes). The problem is that I don't know how to make it alphabetize by last name or arrange by GPA, it just does it on the letters starting at the left side of the screen and working to the right (which essentially means it is alphabetizing by first name...and that isn't useful for me). I also don't know how to arrange the data into what I am going to call "left-aligned columns."

So what I need help with is:
1) How to alphabetize by last name and arrange me GPA.
2) How to display the contents of the file in "left-aligned columns."
3) How to wait for user input before rearranging/closing the console.
ps I am using Netbeans IDE for this and I appreciate any help that you can offer.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
 
package Training;
 
import java.io.*;
class Main
{
   public static void main(String args[])
     {
      try{
          // Open the file called Records
          FileInputStream fstream = new FileInputStream("Records.txt");
          DataInputStream in = new DataInputStream(fstream);
          BufferedReader br = new BufferedReader(new InputStreamReader(in));
          String[] myarray;
                myarray = new String[10];
 
                // Create a for loope that will read each line of the file
                // and place each line in an array
                        for (int j = 0; j < myarray.length; j++){
                        myarray[j] = br.readLine();
 
                // Display each line of the text document
                // This is only here right now to help me with troubleshooting
                        System.out.println(myarray[j]);
                        }
 
          //Close the input stream
          in.close();
 
                // Sort the names alphabeticly and print out the sorted list.
                System.out.println("\n"); // I just wanted a space between this and the first print out
                java.util.Arrays.sort(myarray);
                for (int x = 0; x < myarray.length; x++){
                System.out.println(myarray[x]);
                }
 
          }catch (Exception e){//Catch exception if any
               System.err.println("Error: " + e.getMessage());
          }
 
     }
 
 
 
}