Question
This is a C++ programming. Please show the snap of output too. Thanks Q. PART I Aggregation program Step 1 - Define 2 classes. Above
Q.
PART I
Aggregation program
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
Use pointers: player * ptrPlayer1.... * ptrPlayer7 ... or ... User an Array of players....
( Aggregation - use one pointer or index for each player )
printAllNames()
default constructor - assign each pointer to a player to null/ or array player to unassigned...
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
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