Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Class Stadium maintains a list of non - player characters and processes any attacks. Initially, the list _ npcs is empty. Non - player characters
Class Stadium maintains a list of nonplayer characters and processes any attacks. Initially, the
list npcs is empty. Nonplayer characters can be added by using the Add method of class
Stadium.
When you tell an object of class Stadium to Attack, one of two things will happen:
If the list of nonplayer characters is not empty, then
o The message Bring it on is sent to the console.
o The first character in the list is told to GetHit using the specified amount of dam
age.
Else
o The message Not very effective... is sent to the console.
When you tell an object of class Stadium to AttackAll, one of two things will happen:
If the list of nonplayer characters is not empty, then
o The message Charge is sent to the console.
o Every character in npcs is told to GetHit using the specified amount of damage.
Else
o The message Why is sent to the console.
The abstract class Character defines the common features of nonplayer characters. There are
two classes of nonplayer characters: Mortal and Immortal
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started