Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The primary goal of this project is to allow students to develop and demonstrate

ID: 3637028 • Letter: T

Question

The primary goal of this project is to allow students to develop and demonstrate introductory mastery of
class design and use. This includes the selection and naming of class instance variables, the implemention
of accessor/mutator methods (to support data encapsulation), and the creation and use of a dynamic
number of user created class instances.

Your task is to develop a limited application to track the statistics of soccer players. For each player, your
application must track the player’s first and last name, points scored, assists made, and penalty kick success
rate (as a percentage). You are to design and implement an object capable of recording this information.
You must implement this object as the java class Player.
Your application must allow the user to enter new player information for any number of players, store
all of the information for each player, and allow certain queries to be made on the player statistics currently
recorded. See specification details (below) and sample output (below) for details on the necessary application
operations.

1. There will be two classes: Class Main which implements the functionality of the overall application
and Class Player which defines the information and functionality specific to each individual player.
Note: We would say that class Main HAS-A collection of objects of class Player.
2. Class Player will have the following instance variables to track player data: lastName, first-
Name, pointsScored, assists, and penaltyKickRate. Each of these class variables should be
declared private, appropriately typed, and have corresponding accessor and mutator methods. These
methods should be named according to standard stylistic conventions.
3. The application must prompt the user to perform one of the following operations. I/O will be via the
console and input will be case insensitive. After performing each operation, the user will be queried for
another operation (until the user chooses to QUIT). The operations are:
o ADD: Add a new player and all relevant statistics. Prompts user for last name, first name, etc.
o REMOVE: This operation is used to remove a player from the database. Prompts user for last
name and first name of player to be removed. [For the purposes of this assignment, you may assume
that player names are unique.]
o SHOW: Produced a formatted list of all information for all players currently recorded. Following
this list, report the total number of players currently recorded, and the average points scored, assists,
and penalty kick rate for the recorded players. See sample output for format.
o SAVE: As SHOW, but save the output to file. Prompt user for filename.
o QUIT: End the application.

When the user decides to enter more information, the program will need to construct a new
Player object. The program will use Scanner methods to get the information from the user. The information
will be loaded to the newly constructed Player objects using set methods. Once all data is in
the Player object, the object will be placed into an ArrayList (or other collection) for storage and later
retrieval.

Sample output
What operation next? (ADD, REMOVE, SHOW, SAVE, QUIT)?
ADD
Please enter player’s Last name:
Doe
Please enter player’s First name:
Jane
Please enter number of points scored for Jane Doe:
4
Please enter number of assists for Jane Doe:
2
Please enter penalty kick percentage (example 0.25 for 25%) for Jane Doe:
0.25
** PLAYER ADDED **
Jane Doe: Points: 4 Assists: 2 Penalty Kick %: 0.25
What operation next? (ADD, REMOVE, SHOW, SAVE, QUIT)?
ADD
Please enter player’s Last name:
Doe
Please enter player’s First name:
John
Please enter number of points scored for John Doe:
2
Please enter number of assists for John Doe:
0
Please enter penalty kick percentage (example 0.25 for 25%) for John Doe:

Program is written in java using netbeans.
I really appreciate any help that I receive.

Explanation / Answer

public class SummerLeague extends League implements java.io.Serializable { /** Creates a new instance of SummerLeague */ public SummerLeague() { } public SummerLeague(String id, String name, String sport) throws IncorrectSportException { this.id = id; this.name = name; if (sport.equalsIgnoreCase("swimming") || sport.equalsIgnoreCase("soccer") || sport.equalsIgnoreCase("basketball") || sport.equalsIgnoreCase("baseball")) { this.sport = sport; } else { throw new IncorrectSportException( "Sport is not a summer sport."); } } } public List getPlayersByPosition(String position) { logger.info("getPlayersByPosition"); List players = null; try { CriteriaQuery cq = cb.createQuery(Player.class); if (cq != null) { Root player = cq.from(Player.class); // set the where clause cq.where(cb.equal(player.get(Player_.position), position)); cq.select(player); TypedQuery q = em.createQuery(cq); players = q.getResultList(); } return copyPlayersToDetails(players); } catch (Exception ex) { throw new EJBException(ex); } } List all players in team T2: P6 Ian Carlyle goalkeeper 555.0 P7 Rebecca Struthers midfielder 777.0 P8 Anne Anderson forward 65.0 P9 Jan Wesley defender 100.0 P10 Terry Smithson midfielder 100.0 List all teams in league L1: T1 Honey Bees Visalia T2 Gophers Manteca T5 Crows Orland List all defenders: P2 Alice Smith defender 505.0 P5 Barney Bold defender 100.0 P9 Jan Wesley defender 100.0 P22 Janice Walker defender 857.0 P25 Frank Fletcher defender 399.0
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote