TekSomniaK
[H]ard|Gawd
- Joined
- Mar 26, 2003
- Messages
- 1,144
Ok so my problem is I'm supposed to read multiple lines from a text file, with each line being passed as a string object, then I'm supposed to use the StringTokenizer class to assign variables to each token in the line, which are separated by commas. Here's two sections of my class
And what results is that my integer variables are still 0. Sorry for being a bit noobish and the answer's probably right in front of me but I can't figure it out. If anyone's curious this assignment is to take a text file full of college football teams and determine their rankings, go mizzou baby
Code:
private String name;
private int harris;
private int usaToday;
private int[] computerRanking = new int[6];
Code:
public Team(String line)
{
StringTokenizer st = new StringTokenizer(line, ",");
name = st.nextToken();
harris = Integer.parseInt(st.nextToken());
usaToday = Integer.parseInt(st.nextToken());
for (int i = 0; i < computerRanking.length; i++)
{
computerRanking[i] = Integer.parseInt(st.nextToken());
}
}
And what results is that my integer variables are still 0. Sorry for being a bit noobish and the answer's probably right in front of me but I can't figure it out. If anyone's curious this assignment is to take a text file full of college football teams and determine their rankings, go mizzou baby