Question: C++ Homework - Aggregation PART I Aggregation program - Filename: Week9YourNameAggPlayer Step 1 - Define 2 classes. Above int main() Create a class called PLAYER
C++
Homework - Aggregation
PART I Aggregation program - Filename: Week9YourNameAggPlayer
Step 1 - Define 2 classes. Above int main()
Create a class called PLAYER
string name
getName()
setName( string )
default constructor - set name to 'Unknown'
parm constructor - set name to one name on list of names below
Create a class Called TEAM
player * ptrPlayer1.... * ptrPlayer7
( Aggregation - use one pointer for each player )
printAllNames()
default constructor - assign each pointer to a player to null
Step 2 - Declare instances of classes. In int main()
Instantiate 7 players
Use parm constructor on the first 4 player names
Use the default constructor then use setNames on the last 3 player names
Use the following names: George, Ivan, Hang, Tuyet, Sue, Victoria and Tumbo
Instantiate two teams: basket ball Team , Soccer Team
Step 3 - Use classes. In int main()
Set the last 3 player names using setNames
Add any 5 of the player to the basket ball team, one at a time (5 statements - pass player pointer )
Add all 7 of the players to the soccer team ( 7 statements - pass player pointer )
Print out all the members names in the basket ball team, use printAllNames()
Print out all the members names in the soccer team, use printAllNames()
Delete the Basket ball team
Print out all names in the Basket Ball team
Delete the Soccer Team.
Print out all player names.
Delete each player
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
