Question: Create a class diagram for a base class called scorekeeper. Include a private property called gamePlayed to contain the name of the game being played.Add
Create a class diagram for a base class called scorekeeper.
Include a private property called gamePlayed to contain the name of the game being played.Add a private property which will allow for any number of players. An example may be an array of structures. The container will hold the names and scores of the players.Include a new public method, addName to accept a players name and insert it into the container.Include a public method, getPlayerName to accept the number of the player and return the players name.Include a public method, setGame to update the gamePlayed property by passing it a string containing the name of the game.Include a public method, getGame to retrieve the name of the game.Include a public method, addScore to update a players score by passing it the players name and the points to be added. Return the updated score.Include a public method, subScore to update a players score by passing it the players name and the points to be subtracted. Return the updated score.Include a new public method, listAllScores to print the name of the game being played, the names of each player, and their respective scores.Include an overloaded constructor. The constructor method will accept the name of the game and call the setGame
Some games have additional information that must be monitored during play. Create a class diagram for a subclass called baseball that inherits from the base class scorekeeper.
Add private integer properties for fouls, balls, strikes, and outs.Add a private decimal property to hold the inning number. Set the value to for the first inning where a game starts. Whole numbers will indicate the top of the inning, and half numbers will indicate the bottom: eg would indicate the bottom of the thInclude a public method, advOuts to add to the number of outs. If the number of outs reaches reset balls, strikes, fouls, and outs to and add to innings.Include a public method, getOuts to return the current number of outs.Include a public method, advStrikes to add to the number of strikes. If the number of strikes reaches call advOutsInclude a public method, getStrikes to return the current number of strikes.Include a public method, advFouls to add one to the number of fouls. If the number of strikes is less than advFouls should also add one to strikes.Include a public method, getFouls to return the current number of fouls.Include a public method, advBalls to add one to the number of balls. If the number of balls reaches reset balls, strikes, and fouls. This means the player has been given a walk to first base but does not guarantee and runs were scored.Include a public method, getBalls to return the current number of balls.Include a public method, getInning to return the current inning.Include an overloaded constructor. This constructor method will accept the name of the home team and the name of the visiting team. Check to ensure you got two variables and that they are strings. Then call the setGame and pass it a combined name such as Cubs vs Braves It will also call the addName method to add the two teams to the players property. Assignment Requirements
Create a class diagram for a base class called scorekeeper.
a Include a private property called gamePlayed to contain the name of the game being played.
b Add a private property which will allow for any number of players. An example may be an array of structures. The container will hold the names and scores of the players.
c Include a new public method, addName to accept a player's name and insert it into the container.
d Include a public method, getPlayerName to accept the number of the player and return the player's name.
e Include a public method, setGame to update the gamePlayed property by passing it a string containing the name of the game.
f Include a public method, getGame to retrieve the name of the game.
g Include a public method, addScore to update a player's score by passing it the player's name and the points to be added. Return the updated score.
h Include a public method, subScore to update a player's score by passing it the player's name and the points to be subtracted. Return the updated score.
i Include a new public method, listAllScores to print the name of the game being played, the names of each player, and their respective scores.
j Include an overloaded constructor. The constructor method will accept the name of the game and call the setGame
Some games have additional information that must be monitored during play. Create a class diagram for a subclass called baseball that inherits from the base class scorekeeper.
a Add private integer properties for fouls, balls, strikes, and outs.
b Add a private decimal property to hold the inning number. Set the value to for the first inning where a game starts. Whole numbers will indicate the top of the inning, and half numbers will
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
