Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a small program that will allow the user to create players and then it will allow them to view them by different sorting.
Create a small program that will allow the user to create players and then it will allow them to view them by different sorting. See next slide for sample output. JAVA PROJECTS < Exercise3 src { } exercise3 {} model Player PlayerByGoalsComparator PlayerByNumberComparator + App Enter player name, 0 to stop Bugs Bunny Enter player's number 12 Enter player's number of goals 33 Enter player name, 0 to stop Daffy Duck Enter player's number 8 Enter player's number of goals 25 Enter player name, 0 to stop Sylvester Enter player's number 4 Enter player's number of goals 76 Enter player name, 0 to stop 0 Display players by 1. Name 2. Number 3. Goals 4. Exit 1 Player Bugs Bunny's number is 12 and has 33 goals Player Daffy Duck's number is 8 and has 25 goals Player Sylvester's number is 4 and has 76 goals Display players by 1. Name 2. Number 3. Goals 4. Exit 2 Player info from player.toString() Player Sylvester's number is 4 and has 76 goals Player Daffy Duck's number is 8 and has 25 goals Player Bugs Bunny's number is 12 and has 33 goals Display players by 1. Name 2. Number 3. Goals 4. Exit 3 Player Daffy Duck's number is 8 and has 25 goals Player Bugs Bunny's number is 12 and has 33 goals Player Sylvester's number is 4 and has 76 goals
Step by Step Solution
There are 3 Steps involved in it
Step: 1
yergetNumber t playergetGoals break case 3 Sort the players by goals Collectionssortplayers new Play...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started