Question: Using C# , please complete the following assignment: The program for this assignment will consist of four sections, each headed by the three - line

Using C#, please complete the following assignment:
The program for this assignment will consist of four sections, each headed by the three-line comment below:
//*********************************************************
//****Assignment 10 Section X
//*********************************************************
(where X stands for the portion of the assignment to follow).
Section 1:
Enter the comment with the section title as described above.
Create 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. A dictionary or dynamic array would be a good option. 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. (Note: If the container you used does not have an add method to easily add a value, you will need to include code to determine the next available position.)
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 two constructors. The first one is a default constructor. The second is a constructor method that will accept the name of the game and call the setGame().
Section 2:
Enter the comment with the section title as described above.
Some games have additional information that must be monitored during play. Create a sub-class 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. Whole numbers will indicate the top of the inning and half numbers will indicate the bottom: e.g.,5.5 would indicate the bottom of the 5th.
Include a public method, advOuts(), to add 1 to the number of outs. If the number of outs reaches 3, reset balls, strikes, fouls and outs to 0 and add .5 to innings.
Include a public method, getOuts(), to return the current number of outs.
Include a public method, advStrikes(), to add 1 to the number of strikes. If the number of strikes reaches 3, call advOuts().
Include 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 2, 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 4, reset balls, strikes, and fouls. (This means the player has been given a walk to first base but does not guarantee that 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 two constructors. The first one is a default constructor. The second is a constructor method which will accept the name of the home team followed by the name of the visiting team. It will 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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!