I am having a problem getting an arry to display properly. I am reading in arguments from the command line. I would appreciate any help on this. My code is posted followed by my output, then my input.
My code looks something like this:
public class Tournament
{
public static void main(
String[] args)
{
int sub = 1, count = 0, wins;
int arrayLength = args.length;
String team, rawWins;
Bracketer listGames= new Bracketer();
while (sub < args.length)
{
team = args[sub-1];
rawWins = args[sub];
wins = Integer.parseInt(rawWins);
listGames.listMaker(team, wins, count, arrayLength);
count = count + 1;
sub = sub + 2;
}
}
}
public class Bracketer
{
public Bracketer()
{
}
public void listMaker(String team, int wins, int count, int arrayLength)
{
int[] winList = new int[arrayLength];
String[] teamList = new String[arrayLength];
winList[count] = wins;
teamList[count] = team;
printArrays(winList, teamList);
}
public void printArrays(int[] winList, String[] teamList)
{
for(int i = 0; i <= (winList.length - 1); i++)
{
System.out.println(winList[i]);
System.out.println(teamList[i]);
}
}
}
My output (abbreviated):
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
5
myschool
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
4
campbell
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
0
null
my command line input (or something like it):
UCLA 4 myschool 5 campbell 4 UNCC 12 ...(up to 64 sets of team \wins)