Answer:
The original program is as posted by the user at brainly.com/question/14102353
//Using Java
import java.util.ArrayList;
import java.util.Scanner;
public class PlayerManager {
// Declaration
public static void addPlayer (ArrayList<Integer> players,
int playerNum) {
int i = 0;
boolean foundHigher = false;
foundHigher = false;
i = 0;
while ( (!foundHigher) && (i < players.size()) ) {
if (players.get(i) > playerNum) {
players.add(i, playerNum);
foundHigher = true;
}
++i;
}
if (foundHigher == false) {
players.add(new Integer(playerNum));
}
return;
}
// Prints player numbers currently in ArrayList
public static void printPlayers(ArrayList<Integer> players) {
int i = 0;
for (i = 0; i < players.size(); ++i) {
System.out.println(" " + players.get(i));
}
return;
}
// Maintains ArrayList of player numbers
public static void main (String [] args) {
ArrayList<Integer> players = new ArrayList<Integer>();
addPlayer(players, 55);
addPlayer(players, 4);
addPlayer(players, 50);
addPlayer(players, 19);
printPlayers(players);
return;
//end of the program
}
}