Question: How do I make a class called Army that is a subclass of Squad, so that it inherits all of the features for managing a
How do I make a class called Army that is a subclass of Squad, so that it inherits all of the features for managing a list of units. In addition, for each of the attributes below, I need to:
- Declare a field with the given name and type.
- Define a getter method (accessor) for the field.
- Define a setter method (mutator) for the field.
| Attribute | Type | Description |
|---|---|---|
| playerName | string | The name of the player who owns/runs/plays this army. |
| faction | string | The faction (or species, or planet, or city, etc.) where this army originates. |
The Army class must provide a constructor that takes three string parameters representing the army's name, faction, and player name, in that order.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
