Question: Part 1 - lab (50%) The Army Class the class Code an Army class that holds the information for an Army. The class must have



Part 1 - lab (50%) The Army Class the class Code an Army class that holds the information for an Army. The class must have private data members to include the following information: a) the nationality of an Army, b) the number of units in an Army, and e) the power of an Army. Declare one C++ constant namely MAX_NAME_LEN and set it to 50. Declare three private data members. 1. Declare an array to hold the nationality of an Army, not exceeding MAX_NAME_LEN characters. 2. Declare an integer variable for the number of units in an Army. 3. Declare a double variable for the power of an Army. Store your class definition in a header file named Army.h and your member function definitions in an implementation file named Army.opp. Public Member functions Declare and implement the following member functions. setEmpty: void setEmpty () ; This member function initializes the Army object to a safe empty state. An Army is in an empty state when it has an empty nationality and no units.createArmy; void creatermyfconst char* country, double powJI int troops); It uses three input parameters to initialize an Army object. It receives the nationality of an il-'trmyr the number of units in an Army and the power of the Army. ltvalidates the data values received and uses these data values to set the respective data members. only if all of them are valid. All the data values are valid if a) the first parameter is not nullptr and the length of the name is greater than zero. b) the number of units is greater than zero c) the power is greater than zero. Note: Only copy the first MAX_NAME_LEN characters from the input parameter to the cString data member that holds the nationality of an Army. (you could use
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
