Question: Subject java: /* Class for storing high scores in an array in nondecreasing order. * 2 public class Scoreboard // number of actual entries //

Subject java:Subject java: /* Class for storing high scores in an array in

nondecreasing order. * 2 public class Scoreboard // number of actual entries

/* Class for storing high scores in an array in nondecreasing order. * 2 public class Scoreboard // number of actual entries // array of game entries (names & scores) private int num Entries = 0; 4 private GameEntry board; 5 *Constructs an empty scoreboard with the given capacity for storing entries. 6 public Scoreboard(int capacity) board new GameEntry[capacity]; 9 Attempt to add a new score to the collection (if it is high enough)/ 10 public void add(GameEntry e) 11 int newScore = e.getScore(); 12 / is the new entry e really a high score? 13 f (numEntriesboard.length || newScore > board[numEntries-1].getScore)) 14 15 16 17 18 // no score drops from the board // so overall number increases if (numEntries 0&&boardi-1].getScore)newScore) // shift entry from j-1 to j // and decrement j boardil board[i-1]: 20 boardi e // when done, add new entry 23 24 25 Remove and return the high score at index i. / 26 public GameEntry remove(int i) throws IndexOutOfBoundsException 27 if (i = numEntries) 28 29 GameEntry temp boardli 30 for (int j = i;.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!