Some JAVA help, please?

I guessing that you have the team names in one array in the same spot as the scores in the array for intance teamA[0] goes with scores[0].

I would use a sort loop like this.
-------
int p; //position of the lowest score
int tempScores;
String tempTeams;
for(int i=0; i < scores.length; i++){
int min = 50; //set this to some high number that the wins would never be
for(int x = i; x < scores.length; x++){
if(scores[x]< min){
min = scores[x];
p = x;
}
}
tempScores = scores;
tempTeams = teamsA;
scores = scores[p];
teamsA = teamsA[p];
scores[p] = tempScores;
teamsA[p] = tempTeams;
}
-------

You will need to figure out how to read from your file and put the scores in an int array rather than a String array.

Of course this is not really efficient but it works.

I havent tested this code I just wrote it from the top of my head.
Let me know if it helps
 
Back
Top Bottom