DO NOT USE any of the STL in your code.
Implement a max-heap using a dynamic array implementation. The class should be named GameHeap, and it uses the same dataset as in PA 3 (boardgames.csv). Write all basic class functions (default and copy constructors, destructor, copy assignment).
GameHeap has a data member gameList, which is an array of Games. Set the initial size of gameList to 4, and double the size as needed. A Game is similar to a TreeNode in PA 3. The title acts as a key, and bigger keys have higher priority (ex. "B" before A).
struct Game{
string name; //used as key
int maxPlayers;
int playtime;
};
Implement the following functions:
1. void insert(string title, string maxPlayers, string playtime). You should first check all the games in gameList to see if the game is already in the heap. If so, update the maxPlayers and playtime of the Game. Otherwise, create and add a Game to the heap (i.e., gameList). The heap should grow as needed.
2. string deleteMax(): deletes the Game with the max key and returns its name.
3. print(): prints all the games in the heap using the following format - arr[i]: name (See the execution example).
4.printGame(string name): finds and prints all the information about the game.
Provide a driver/client program to demonstrate your functions. You can create a GameHeap and add all the games in boardgames.csv to the heap. Test ALL the functions thoroughly in the driver, including all the edge cases.
The GameHeap class should be in two files named gameheap.h and gameheap.cpp. The driver should be in a file named pa4.cpp.
[PA4]./pa4
Hello! Processing the boardgames.
The array is full. Resizing array to 8 elements.
The array is full. Resizing array to 16 elements.
Printing tree:
arr[1] = Ticket to Ride
arr[2] = The Game of Life
arr[3] = The Settlers of Catan
arr[4] = Risk
arr[5] = Scrabble Scattergories
arr[6] = Pandemic
arr[7] = Cluedo
arr[8] = Love Letter
arr[9] = Monopoly
arr[10] = Codenames
arr[11] = Dominion
Which game do you want to print? Love Letter
Name: Love Letter
Maximum # of players: 4
Playtime: 20 minutes
Which game do you want to print? Testing
Testing is not in the heap.
Removing the max value. "Ticket to Ride" has been removed.
Printing the updated heap:
arr[1] = The Settlers of Catan
arr[2] = The Game of Life
arr[3] = Pandemic
arr[4] = Risk
arr[5] = Scrabble Scattergories
arr[6] = Dominion
arr[7] = Cluedo
arr[8] = Love Letter
arr[9] = Monopoly
arr[10] = Codenames
Removing the max value. "The Settlers of Catan" has been removed.
Printing the updated heap:
arr[1] = The Game of Life
arr[2] = Scrabble Scattergories
arr[3] = Pandemic
arr[4] = Risk
arr[5] = Codenames
arr[6] = Dominion
arr[7] = Cluedo
arr[8] = Love Letter
arr[9] = Monopoly
This is the end of the execution example. Goodbye!