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:

  1. Declare a field with the given name and type.
  2. Define a getter method (accessor) for the field.
  3. 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

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!