Question: Java- Please do node by node You have been asked by the PGA players association to be in charge of recording golf scores at the
Java- Please do node by node
You have been asked by the PGA players association to be in charge of recording golf scores at the Java Golf Tournament. As the player finishes the round, you will be asked to keep track of the name and score (this should constitute a Java blueprint class named Player It should have two fields, the name, and score. Make certain to include the constructors, toString() method, and your getters and setters. Scores MUST be kept in ascending order (smallest at the front ) in a doubly-linked list. You will need a menu-driven program with the following items:
1) Load original data2)Print the names and scores in ascending order)Print the names and scores in descending order)Given the name of a player, find that players score and list all other players with the same score5)Add a player (ask the user for the name and score). Insert them in the correct location in the data structure6)Delete a player (ask the user for the name)7)Clear the doubly linked list8)Exit here is my
Player class public class Player implements Comparable { private String name; private int score; public Player() { super(); } @Override public String toString() { return "Player name " + name + ", score = " + score;} public Player(String name, int score) { super(); this.name = name; this.score = score; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } @Override public int compareTo(Player o) { if(o.score this.score) return 1; else return 0; } public boolean equals( Player p ) { return name.equals( p.name ); }}
Player name Jordan Spieth, score = -13 Player name Bubba Watson, score = -9 Player name Rory McIory, score = -9 Player name Justin Rose, score = -9 Player name Jason Day, score = -2 Player name Tiger Woods, score = 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
