Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C# ONLY Section 3 : Enter the comment with the section title as described above. Write code to test the base class. This can

Using C# ONLY Section 3:
Enter the comment with the section title as described above.
Write code to test the base class. This can be done in multiple ways and should be done when thoroughly testing your code. However, for this program's output,
you will use the following method:
a. Print to the console the message, "Assessment Part 2- Classes and Inheritance" followed by a blank line.
b. Print "Section 3: Base Class Results After Adding" to the console followed by a blank line.
c. Instantiate an object called gameOne, from the scoreKeeper class, passing "Canasta" as the game name to the constructor.
d. Call the addName() method three times to add the players, "Larry", "Moe", and "Curly".
e. Print a blank line to the console for ease of reading.
f. Call the object's addScore() method three times. Once for Larry, adding 20 points to his score. A second time for Moe, adding 35 points to Moe's score. Then
a third time for Curly, adding 45 points to Curly's score.
g. Using the listAllScores() method, print a report of the players and their respective scores to the console.
h. Call the object's subScore() method twice. Once for Moe, subtracting 15 points from his score. The second time, subtract 5 points from Curly's score.
i. Print "Section 3: Base Class Results After Subtracting" to the console followed by a blank line.
j. Using the listAllScores() method, print a report of the players and their respective scores to the console.
k. Print two blank lines to the console.
Section 4:
Enter the comment with the section title as described above.
Write code to test the sub-class. This can be done in multiple ways and should be done when thoroughly testing your code. However, for this program's output,
you will use the following method:
a. Print "Section 4: Derived Class Results: Baseball Scoring" to the console followed by a blank line.
b. Instantiate an object called gameTwo, from the baseball class, passing "Cubs" and "Braves" as the teams (or teams of your choosing), to the constructor.
(Note: If you use different team names, substitute them below for 'Cubs' or 'Braves'.)
c. The following method calls should be done in order to guarantee the correct results.
i. Call the addScore() method to advance the Cubs' score by 2.
ii. Call the advOuts() method three times.
iii. Call the addScore() method to advance the Braves' score by 3.
iv. Call the advOuts() method once.
v. Call the advStrikes() method once.
vi. Call the advFouls() method thrice.
vii. Call the advBalls() method once.
viii. Call the listAllScores() method to print the game and scores. Also, print a blank line to the console.
ix. Use the appropriate get methods to print the current inning, outs, strikes, fouls, and balls.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe the various sources of export assistance.

Answered: 1 week ago