Question: Assignment 3 : Game Scores Management with Singly Linked List ( Without User Input ) Develop a C + + application to manage the top

Assignment 3: Game Scores Management with Singly Linked List (Without User Input)
Develop a C++ application to manage the top game scores using a singly linked list,
implementing add and remove functionalities. This includes creating a GameEntry
class, a GENode class for the linked list structure, and a Scores class to manage
the game entries. The singly linked list will have a maximum number of elements
it can hold (maxEntries data member).
***
Part 1: Implementation
### GameEntry Class Implementation
Create a class GameEntry to store game entries.
#### GameEntry.h (Header File)
- Member Variables (Private):
- std::string name; // Player's name
- int score; // Player's score
- Member Functions (Public):
- GameEntry(const std::string& n="", int s=0); // Constructor
- std::string getName() const; // Get player nAssignment 3: Game Scores Management with Singly Linked List (Without User Input)
Develop a C++ application to manage the top game scores using a singly linked list,
implementing add and remove functionalities. This includes creating a GameEntry
class, a GENode class for the linked list structure, and a Scores class to manage
the game entries. The singly linked list will have a maximum number of elements
it can hold (maxEntries data member).
***
Part 1: Implementation
### GameEntry Class Implementation
Create a class GameEntry to store game entries.
#### GameEntry.h (Header File)
- Member Variables (Private):
- std::string name; // Player's name
- int score; // Player's score
- Member Functions (Public):
- GameEntry(const std::string& n="", int s=0); // Constructor
- std::string getName() const; // Get player name
- int getScore() const; // Get player score
- void setName(std::string nName); // Set player name
- void setScore(int nScore); // Set player score
#### GameEntry.cpp (Implementation File)
- Implement the functions declared in GameEntry.h.
### GENode Class Implementation
Develop GENode with the following structure to represent a node in the singly linked list.
#### GENode.h (Header File)
- Member Variables (Private):
- GameEntry elem; // Game entry stored in the node
- GENode* next; // Pointer to the next node
- Member Variables (Public):
- static int activeNodes; // Static variable to track number of active nodes
- Member Functions (Private):
// Inside the body of the constructor increment activeNodes by one
//when a node is created
- GENode(const GameEntry& e, GENode* n = nullptr); // Constructor
- Member Functions (Public):
// Inside the body of the destuctor decrement activeNodes by one
//when a node is destroyed
- ~GENode();
### Scores Class Implementation
Construct Scores to manage a list of GameEntry objects using a singly linked list.
#### Scores.h (Header File)
- Member Variables (Private):
- int maxEntries; // Maximum number of entries
- int numEntries; // Current number of entries
- GENode* head; // Head of the list
- GENode* tail; // Tail of the list
- Member Functions (Public):
- Scores(int maxEnt =10); // Constructor
- ~Scores(); // Destructor
- void add(const GameEntry& e); // Add a game entry
- GameEntry remove(int i) throw(IndexOutOfBounds); // Remove a game entry
- void printAll(); // Print all game entries
- bool empty() const; //returns true if the list is empty and false otherwise
- int size() const; //returns current number of entries in the list
- int capacity() const; //returns max number of entries allowed in the list (top 5)
#### Scores.cpp (Implementation File)
- Implement the functions declared in Scores.h.
### Exception Handling Implementation
Utilize RuntimeException and IndexOutOfBounds classes for handling exceptions.
### Main Function Implementation
Implement the main function in a separate .cpp file (main.cpp) to demonstrate
the functionality of the Scores class.
#### main.cpp
- Include the necessary files
- Initialize the static variable activeNodes with 0 before main function
example code:
#include ....
int GENode::activeNodes =0;
int main(){.....}
- Implement the main function
#### Main Function Details
- Create an object of type Scores, with maxEntries =5.
- Add 4 GameEntry items with different scores, minimum score of 5.
- Print all entries.
- Add 3 other GameEntry items with scores interspersed among the first 4.
- Print all entries after additions.
- Remove the first GameEntry item.
- Print all entries after removal.
Explain each step thoroughly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!