Question: please help me solve this problem this is what I have so far A . First, create ( with Notepad application ) and copy the

please help me solve this problem this is what I have so far
A. First, create (with Notepad application) and copy the below data (not the captions) into a file name Games.txt
B. You are to write a program to do the followings:
1. Define a class named CGame
2. You are to define an enumeration type GameDuration including 5 values \(\mathrm{ZERO}=0,\mathrm{FIFTY}=50,\mathrm{SIXTY}=60\), SEVENTY=70, EIGHTY=80 and NINETY=90(given) in the header file Game.h. It should be defined before the definition of the class CGame.
3. Then, create an array of 12 elements typed CGame (in main file)
4. Create a menu with the following options:
a. List all games
b. List all games of a specific duration
c. List all games with duration lower than a specific number of minutes
d. List all games with duration higher than a specific number of minutes
e. List information of a specific game
f. Calculate referee payments of a specific game
g. Add a game
h. Remove a game
i. Update a game
j. Quit
Add a new function readGameInfo() to read the list of games from the input file Games.txt into the array of games. This
function should be called first in main(). See HW6 for references.
Add a new function writeGameInfo() to write the current information of the games from the application to the file Games.txt.
This function should be called in the Quit option before terminating your application. The file Games.txt is then updated with
the latest information of the games.
For option "List all games with grade ...", ask for that specific duration and then use operators ==,> or for comparison.
For option "List information of a specific game", ask for game id and then search for it in the list.
If found, list the information of the that specific game.
Otherwise, raise an error message and return to the menu.
For option "Calculate referee payments of a specific game", ask for game id and then search for it in the list.
If found, calculate Center and AR payments and show the results (same as Project 1).
Otherwise, raise an error message and return to the menu.
For option "Add a game", search for an available slot (i.e. id is"G000").
If there is one, ask for new game information (id, duration, rate) and then insert the information into that slot.
If there is no slot available, raise an error message and return to the menu.
For option "Remove a game", ask for game id and then search for it in the list.
If found, reset the information with the default values used in the default constructor.
Otherwise, raise an error message and return to the menu.
For option "Update a game", ask for game id and then search for it in the list.
If found, ask for its new duration, rate and validate these new values (same as Project 1). Then, update the information for
that game.
Otherwise, raise an error message and return to the menu.
void displayHenu();
void listAllGames(const vector& games);
void listGamesByDuration(const vector& games, int duration);
void listGamesLowerThanDuration(const vector& games, int maxDuration);
` int main()
{
vector games(12);
readGameInfo(games);
char choice;
do {
displayHenu();
std::cin >> choice;
switch (choice){
case 'a':
listAllGames(games);
break;
case 'b': {
int duration;
std::cout "Enter specific duration: ";
std::cin >> duration;
listGamesByDuration(games, duration);
break;
}
case 'j':
writeGameInfo(games);
std::cout "Exiting program." std::endl;
break;
default:
std::cout "Invalid choice. please try again." std::endl;
}
} while (choice !='j');
return 0;
}
` void displayHenu(){
std::cout "
Menu:
";
std::cout "a. List all games
";
std::cout "b. List all games of a specific duration
";
std::cout "j. Quit
";
std::cout "Enter your choice: ";
}
` void listAllGames(const std::vector& games){
`}\mathrm{ for (const auto& game : games){
game.display();
}
}
void listGamesByDuration(const std::vector& games, int duration){
for (const auto& game : games){
if (game.getDuration()== duration){
+- P4
#pragma once
#include
#include
#include
#include
using namespace std;
` enum GameDuration {
ZERO =0,
FIFTY =50,
SIXTY =60,
SEVENTY =70,
EIGHTY =80,
NINETY =90
};
#include
#include
#include
#include
using namespace std;
class CGame
{
public:
CGane() : id("G0000"), duration(ZERO), rate(0.0){}
CGame(string id, GameDuration duration, double rate)
: id(id), duration(duration), rate(rate){}
string getId() const { return id; }
GameDuration getDuration() const { return duration; }
double getRate() const { return rate; }
void setId(const string& newId){ id = newId; }
void setDuration(GameDuration newDuration){ duration = newDuration; }
void setRate(double newRate){ rate = newRate; }
void display() const {
cout \ll "ID: " id ", Duration: " duration ", Rate: " rate endl;
}
private:
string id;
GameDuration duration;
double rate;
};
void readGameInfo(vector& games)
please help me solve this problem this is what I

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!