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 Tennis
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

