I'm writing a fantasy basketball team program in Netbeans where 10 teams play 2 games against each team and I'm trying to keep track of each team's number of wins and losses. The ten teams are stored to an array list, and I have two loops set to iterate through the array without repeats, but I can't figure out for the life of me to how to keep track of the wins and losses for each team and store them in the correct place in my array. Code is as follows
for (x = 0; x < alCTeams.size() - 1; x++) {
for (y = x + 1; y < alCTeams.size(); y++) {
for (iGameCount = 0; iGameCount < 2; iGameCount++) {
do {
iHTScore = rndGenerator.nextInt(100);
iVTScore = rndGenerator.nextInt(100);
if (iGameCount % 2 == 0)
iHTScore += 5;
else
iVTScore += 5;
} while (iHTScore == iVTScore);
if (iHTScore > iVTScore) {
iHTWins++;
iVTLosses++;
} else {
iHTLosses++;
iVTWins++;
}
}
alCTeams.get(y).setWins(iVTWins);
alCTeams.get(y).setWins(iVTLosses);
}
alCTeams.get(x).setWins(iHTWins);
alCTeams.get(x).setLosses(iHTLosses);
}