Question: 1 (16 points) Write a short main method that uses the SimpleScoreboard class you wrote in question 2. The program should create a simpleScoreboard object

1 (16 points) Write a short main method that uses the SimpleScoreboard class you wrote in question 2. The program should create a simpleScoreboard object and then prompt the user for player names and scores, ending when the user enters an empty String for a name. The code should then display the scoreboard entered by the user in the format given below. An example transcript is shown below (user inputs are in bold type). Make sure your code matches the example transcrit PLAYER: Bob SCORE: 1000 PLAYER: Jane SCORE: 900 PLAYER: Bob: 1000 Jane: 900 public static void main(String[] args) { public class SimpleScoreboard private AmyList Sering players private ArrayList Integer scores public SimpleScoreboard) players null; SCOTCS null: private int getIndexOfPlayerString player Name) if players.contains player Name retum players.indexOfiplayer Name sy retum. 1: public boolean addString playerName. Integer core) if players.contains playerName) return false; players add player Name scores addiscore return true; public int lookup(String playerName) il players.containsiplayer Name retum scores get players.indexOf playerNamelt else retum-1: public ArrayList String gettist Players return players public boolean updateString playerame. Integer core) if players.contains(playerName)) return false; else scores set players.indexOf(playerName. core public boolean removedString playerName) if players.contains(playerName)) return false; else int a players.indexOplayer Name players.remover scores.removal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
