Question: Help with JAVA please: FootballPlayer Class - Abstract Class Instance variables include: Player's name. Position - in this project it's either quarterback, runningback or defensiveback.
Help with JAVA please:
FootballPlayer Class - Abstract Class
- Instance variables include:
- Player's name.
- Position - in this project it's either quarterback, runningback or defensiveback.
- NFL Team
- Number of Games played this season.
- Constructors
- Default constructor, sets all instance fields to a default value.
- Parameterized constructor - sets all instance variables to the parameterized value (hint use mutator methods for data integrity and ease of testing).
- Methods
- Abstract playersRating method that returns an integer that is calculated based on their statistics (specific formula is outlined in the subclasses below).
- compareTo method
- Similar to the compareTo method prevalent in the API.
- Returns a positive int if the calling player's rating is higher than the parameter's player's rating
- Returns a negative int if the calling player's rating is lower than the parameter's player's rating
- Return zero if their ratings are equal.
- toString method
- returns a String representation of the object, in the format:
Name: Phil Sims, Position: Quarter Back, NFL Team: Giants
QuarterBack Class - subclass of FootballPlayer
- Stores statistics specific to QuarterBacks
- Instance variables (all ints)
- Pass Attempts
- Pass Completed
- Touchdowns Passing
- Total Yards Passing
- Constructors
- Default constructor, sets all instance field to a default value. Remember to pass appropriate values to super class.
- Parameterized constructor - sets all instance variables to the parameterized value (hint use mutator methods for data integrity and ease of testing)
- Methods
- double completionPercentage() Formula: passes completed / pass Attempts
- double averagePassingYardsPerGame() Formula: total yards passing/games Played
- double averageTouchDownsPerGame() Formula: touch Downs Passing/games Played
- playerRating
- overwrite of abstract method
- Calculation is the sum of:
Average Touch Downs Per Game + (Completion Percentage * 100) + (Average Passing Yards Per Game / 5);
- toString (hint use the super classes toString)
- returns a String representation of the object
- In the format:
Name: Phil Sims, Position: Quarter Back, NFL Team: Giants Completion Percentage: 0.25, Average Passing Yards Per Game: 500.00 Average Touch Downs Per Game: 1.50, Player's Rating: 127
RunningBack and DefensiveBack are similar to the QB but have slightly different instance variables and statistical methods.
RunningBack Class
- Similar to the QuarterBack class except for slightly different instance variables and statistical methods.
- Instance Variables (all ints)
- Running Attempts
- Total running yards
- Touchdowns
- Constructors
- Default constructor, sets all instance field to a default value. Remember to pass appropriate values to super class.
- Parameterized constructor - sets all instance variables to the parameterized value (hint use mutator methods for data integrity and ease of testing)
- Methods
- Statistical methods all return a double
- averageYardsPerGame
- averageYardsPerAttempt
- averageTouchDownsPerGame
- playerRating is sum of
averageTouchDownsPerGame() + averageYardsPerAttempt()+ (averageYardsPerGame()/5);
- toString similar to QuarterBack but with RunningBack info.
- Statistical methods all return a double
DefensiveBack Class
- Similar to the QuarterBack class except for slightly different instance variables and statistical methods.
- Instance Variables (all ints)
- Tackles
- Interceptions
- Forced Fumbles
- Constructors
- Default constructor, sets all instance field to a default value. Remember to pass appropriate values to super class.
- Parameterized constructor - sets all instance variables to the parameterized value (hint use mutator methods for data integrity and ease of testing)
- Methods
- Statistical method all return a double
- averageTacklesPerGame
- averageInterceptionsPerGame
- averageForcedFumblesPerGame()
- playerRating is sum of
(averageTacklesPerGame() + averageInterceptionsPerGame() + (averageForcedFumblesPerGame()/5)) * 10;
- Statistical method all return a double
- toString similar to QuarterBack but with DefensiveBack info
FantasyFootballTeam Class
- Stores a collection (Array) of FootballPlayer objects and performs basic search and toString operations.
- Instance variables
- Team Name
- Team Owner
- Array of FootballPlayer objects
- Variable to handle a partially filled array.
- Parameterized constructor
- takes in a team name, owner and size of the array
- creates the array.
- sets the partially filled array value as appropriate
- Methods
- addPlayer
- Takes in a FootballPlayer object and add it to the Array.
- Ensures the parameter is not null and the array is not full. If it is already full, an error message should be displayed indicating that there is no room on the team.
- findPlayerbyPosition
- search the array for all players at a particular position (ignore case).
- returns a string of all the players at that position or a string stating no players at that position. Such as
No player at QuarterBack found.
- toString - a String representation of the object such as
Team Name: UWF Argos Owner: The Great State of Florida Name: Phil Sims, Position: Quarter Back, NFL Team: Giants Completion Percentage: 0.25, Average Passing Yards Per Game: 500.00 Average Touch Downs Per Game: 1.50, Player's Rating: 127 Name: Jim Brown, Position: Running Back, NFL Team: Browns Running Yards Per Game: 104.17, Running Yards Per Attempt: 9.77 Average Touch Downs Per Game: 0.67, Player's Rating: 31 Name: Spider Lockart, Position: Defensive Back, NFL Team: Giants Tackles Per Game: 1.43, Interceptions Per per Game: 0.36 Forced Fumbles Per Game: 0.21, Player's Rating 18
- addPlayer
FantasyFootballTester class
- Create at least two instances of each player type.
- Two QuarterBack, RunningBack and DefensiveBack objects.
- Hard code these object, No user or file input is required or desired.
- Create at least two FantasyFootballTeam objects.
- Add at least one player per position to each team.
- Compares players to completely test the compareTo method.
- Test all methods in all the class directly or indirectly.
- Indirect testing
- Calls a method that calls others methods.
- Example the playerRating method would call all the statistical methods or the toString would call all the accessor method.
Sample run
Example run only, use as a guide not a solution.
Team Name: VW football Owner: The Great State of Florida Name: Phil Sims, Position: Quarter Back, NFL Team: Giants Completion Percentage: 0.25, Average Passing Yards Per Game: 500.00 Average Touch Downs Per Game: 1.50, Player's Rating: 127 Name: Jim Brown, Position: Running Back, NFL Team: Browns Running Yards Per Game: 104.17, Running Yards Per Attempt: 9.77 Average Touch Downs Per Game: 0.67, Player's Rating: 31 Name: Spider Lockart, Position: Defensive Back, NFL Team: Giants Tackles Per Game: 1.43, Interceptions Per per Game: 0.36 Forced Fumbles Per Game: 0.21, Player's Rating 18 Team Name: Beach Bums Owner: The Dude Name: Steve Young, Position: Quarter Back, NFL Team: 49ers Completion Percentage: 0.25, Average Passing Yards Per Game: 375.00 Average Touch Downs Per Game: 1.50, Player's Rating: 102 Name: Saquon Barkley, Position: Running Back, NFL Team: Giants Running Yards Per Game: 104.50, Running Yards Per Attempt: 11.40 Average Touch Downs Per Game: 0.67, Player's Rating: 33 Name: Aqib Talib, Position: Defensive Back, NFL Team: Rams Tackles Per Game: 2.14, Interceptions Per per Game: 0.50 Forced Fumbles Per Game: 0.43, Player's Rating 27 Testing Finding player by position "Quarter Back" on team "VW football" Phil Sims Testing comparing two players rating Comparing Phil Sims with Steve Young Phil Sims has a higher rating;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
