Question
Declare necessary classes so that the following main function works as intended. Your classes must be as small as possible in size. Make use of
Declare necessary classes so that the following main function works as intended.
Your classes must be as small as possible in size. Make use of polymorphism as much as possible. Do not use function overloading. Each class must have only one constructor. Do not change the main function. Your code should assume that the number of players that can be inserted to the array is only limited by the available RAM. So do not assume that there will always be three players.
Make sure that there are no memory leaks.
int main() { PlayerArray Players; Players.Insert(new TennisPlayer("Ahmet")); Players.Insert(new SoccerPlayer("Mehmet", 9)); //Integer parameter is the jersey number. Players.Insert(new TennisPlayer("Hatice")); Players.Print(); return 0; }
Output should look like:
Player Ahmet plays Tennis Player Mehmet(9) plays Soccer Player Hatice plays Tennis
Urgent! Urgent! Urgent!
Question 2 [35 points] Declare necessary classes so that the following main function works as intended. Your classes must be as small as possible in size. Make use of polymorphism as much as possible. Do not use function overloading. Each class must have only one constructor. Do not change the main function. Your code should assume that the number of players that can be inserted to the array is only limited by the available RAM. So do not assume that there will always be three players. Make sure that there are no memory leaks. int main() { PlayerArray Players; Players. Insert(new TennisPlayer("Ahmet")); Players. Insert(new SoccerPlayer("Mehmet", 9)); //Integer parameter is the jersey number. Players. Insert(new TennisPlayer("Hatice")); Players.Print(); return; } Output should look like: Player Ahmet plays Tennis Player Mehmet (9) plays Soccer Player Hatice plays Tennis Question 2 [35 points] Declare necessary classes so that the following main function works as intended. Your classes must be as small as possible in size. Make use of polymorphism as much as possible. Do not use function overloading. Each class must have only one constructor. Do not change the main function. Your code should assume that the number of players that can be inserted to the array is only limited by the available RAM. So do not assume that there will always be three players. Make sure that there are no memory leaks. int main() { PlayerArray Players; Players. Insert(new TennisPlayer("Ahmet")); Players. Insert(new SoccerPlayer("Mehmet", 9)); //Integer parameter is the jersey number. Players. Insert(new TennisPlayer("Hatice")); Players.Print(); return; } Output should look like: Player Ahmet plays Tennis Player Mehmet (9) plays Soccer Player Hatice plays TennisStep 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