Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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