Question: Create a Player class. This class will have an abstract function called playGame(). It will pass in an int value for the number of minutes
Create a Player class. This class will have an abstract function called playGame(). It will pass in an int value for the number of minutes played. Store the Player's name, team name, and playing time as field variables. What access level should they have?
Create 2-3 subclasses that extend Player class. I.e. HockeyPlayer, FootballPlayer, etc...
Make sure to add some field variables to those classes.
Implement a toString for all of them and call the super's toString method from the subclasses.
Please use entry code in final answer.

public abstract class Player { String name; String teamName; double playingTime; Player (String name, String team, double pt) { this.name = name: teamName = team: playingTime = pt; } public abstract void playGame (int minsPlayed); @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Payer {name=").append(name) : sb.append(", teamName=").append(teamName); sb.append(", playingTime=").append (playingTime); sb.append('}'); return sb.toString()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
