Help with arrays

I have some java methods that I need to keep in place, written by another person. The program will read in a user given file, which is a series of data associated with a person's name. This data is given in a semi-colon delimited line, like so:

I'm hitting a bit of a logic wall here and can't figure out how to read the data in from the user-chosen file, and then place the proper data in the proper array. I've gotten a simple scanner method started that will read through the file, then another scanner that will read through every portion of a line, but I'm not sure how to store specific parts of that line to specific arrays. The first element of the array will always be Name, the second will always be Quarter 1, etc. My scanning code:

Java Code:

public static void readFile( String filename ) throws IOException
{
Scanner keyboard = new Scanner(System.in);
int i=0;
String line = keyboard.nextLine(); // get the line as a string
Scanner lineScanner = new Scanner(line); // scanner for reading words from the line
String[] myString = new String[1000];
while(lineScanner.hasNext()) { // while there is a word left in the line
myString[i] = lineScanner.next();
i++;
}

Any help would be appreciated! I've just hit a wall here and am not certain where to go from here...

Re: Help with arrays

Your line parser needs to correlate the position of the data it is getting with what that data is so that is puts the data in the correct array.
The first piece of data is the Name, the next n data items are the quarter, the next q are the years etc
Keep track of which data element: 0,1,... you are getting from the line that was read so that you know which array and slot you should put it in.

By creating a parse (the string.split), would the data then be stored into a string? Would the data then look like an array?
({Lee McStein},{8},[9},{10}.....)?

Actually, typing this, I realize I am still totally lost. I'm still very new to java and am having some problems with the logic behind these arrays. Is there any chance you could explain your thought process again, but perhaps a little slower for me?

Re: Help with arrays

By creating a parse (the string.split), would the data then be stored into a string? Would the data then look like an array?

You need to read the API doc for the split() method. Then write a very short simple program that uses it to see what it does.
After using the split method, use the Arrays.toString() method to print out the contents of the array that was created so you can see what split() did.

When the data is parsed into the array, you need to pick out the different pieces as per the layout and order of the input line that was read and parsed. For example the first item is the name, the next n are quarter, the next q are something else. Each piece needs to be copied to the target arrays where you are saving the data.

Take a piece of paper and write out the contents of the input line and the arrays the data is to go to. Draw lines on the paper showing where each piece of data in the line that was read is to go in each of the arrays.

I need to read in a file that is given to the program as the first command line argument. I assumed that meant the program would need to ask the user for the filename? Or does this mean that this is created in the run configurations? Given that I need to use this structure, would the .split method still be the best way to go?

I'm sorry to ask so much, I really am just lost at this point and would love to be pointed in the right direction. Thank you!

Re: Help with arrays

You should solve one problem at a time before moving on to the next problem.
For now just hardcode the name of the file in the program and work on the logic to read the lines from the file and to extract from each line the data it contains.