Question: HELP!! Game.h #pragma once #include #include #include #include #include using namespace std; enum GameDuration { ZERO = 0 , FIFTY = 5 0 , SIXTY

HELP!!
Game.h
#pragma once
#include
#include
#include
#include
#include
using namespace std;
enum GameDuration
{
ZERO =0,
FIFTY =50,
SIXTY =60,
SEVENTY =70,
EIGHTY =80,
NINETY =90
};
class CGame
{
public:
string id;
GameDuration duration;
CGame() : id("G000"), duration(ZERO), payRate(0.0){}
CGame(string i, GameDuration d, float p)
{
id = i;
duration = d;
SetPayRate(p);
}
void getInfo();
float getPayRate() const;
void setPayRate(float rate);
void readGameInfo(const vector& games);
void writeGameInfo(const vector& games);
void displayMenu();
void listAllGames(const vector& games);
void listGamesByDuration(const vector& games, GameDuration duration);
void listGamesLowerThanDuration(const vector& games, int maxDuration);
void listGamesHigherThanDuration(const vector& games, int minDuration);
void findGameById(const vector& games, const string& id);
void addGame(vector& games);
void removeGame(vector& games, const string& id);
void updateGame(vector& games, const string& id);
private:
float pavRate:
CGame.cpp
#include
#include
#include
#include > d;
duration = static_cast(d);
float pay;
cout "Please Enter Pay Rate: $";
cin >> pay;
setPayRate(pay);
}
float CGame::getPayRate() const
{
}
return payRate;
` vold CGame::setPayRate(float rate)
{
If (rate >=1.50 sta rate =5.00)
{
}
payRate = rate;
else {
payRate =0.0;
}
}
vold CGane::readGaneInfo(const vector*CGane>& games)
i
1fstream flle("Games.txt");
if (!file){
std::cerr "Error opening file." std::endl;
return;
}
std::string id;
int duration;
double rate;
while (file >> id >> duration >> rate){
GameDuration enunDuration = static_cast(duration);
games.push_back(CGame(id, enunDuration, rate));
}
file.close();
}
vold CGame::writeGameInfo(const vectorsCGame>& games)
{
ofstream file("Games.txt");
for (const auto& game : games){
}
file game.getid()"" game.getDuration()"" game.getRate() std::endl;
file.close();
}
void CGane::displayMenu()
i
cout "Menu:
";
cout "a. List all games
";
cout "b. List all games of a specific duration
";
cout "C. List all games with duration lomer than a specific number of minutes
";
cout "d. List all games with duration higher than a specific number of ninutes
";
cout "e. List information of a specific game
";
cout "f. Calculate referee payments of a specific game
";
cout "g. Add a game
";
cout "h. Renove a game
";
cout =1. Update a game
";
cout "j. Quit
";
cout "Enter your choice: ";
#pragma once
|` #include
#include
#include
#include
#include
using namespace std;
enum GameDuration
{
ZERO =0,
FIFTY =50,
SIXTY =60,
SEVENTY =70,
EIGHTY =80,
NINETY =90
};
class CGame
{
public:
string id;
GameDuration duration;
CGame() : id("G000"), duration(ZERO), payRate(0.0){}
CGame(string i, GameDuration d, float p)
{
id = i;
duration = d;
setPayRate(p);
}
void getInfo();
float getPayRate() const;
void setPayRate(float rate);
void readGameInfo(const vector& games);
void writeGameInfo(const vector& games);
void displayMenu();
void listAllGames(const vector& games);
void listGamesByDuration(const vector& games, GameDuration duration);
void listGamesLowerThanDuration(const vector& games, int maxDuration);
void. listGamesHigherThanDuration(const vector& games, int minDuration);
void findGameById(const vector& games, const string& id);
void addGame(vector& games);
void removeGame(vector& games, const string& id);
void updateGame(vector& games, const string& id);
private:
float pavRate:
elinctude slastrean>
**nclude
*include
*include
using nanespace std;
Y vold cGane: : getinfo()
i
lng d;
cout "Please Enter Game buration:(6,58,68,76,86,9a): *;
cin >z d;
duration = static_cast
float pay:
cout
cin 3> pay;
setPayRate(pay);
3
float CGameatgetPayRate() const
i
return payRate;
l
vold CGame:isetPayRate(float rate)
i
1f (rate =1.50:Eg rate s=5.00)
i
payRate = rate;
}
else f
payRate =0.8;
}
1
V vold CGane::readGameInfo(const vector
i
1fstrean file(*Games.txt");
if (ifile)[
std:tcerr
return;
}.
std::string Id;
Int duration;
double rate;
mhile (file s> id $s duration $s rate){
Gaineburation enunDuration statlc_casts6ameburation>(duration);
gares.push_back(CGana(id, enunDuration, rate));
}
file.close();
\
y vold cGane::mriteGaneInfo(const vectorscGame>& games)
i
@fistrean file(*Games.txt");
for (const autos game : ganes){
file
}
file.closeO;
}
vald CGame:tdisplayHenu(%)
f
cout sMena;
";
cout *a. list all ganesin";
cout *b: list all ganes of a specific duration
";
cout C. List all ganes with dwration lower than a speciflic number of minutes
;
cout "d. Lis
{
for (const auto& gase : games){
gane.display();
}
}
yold CGane :: 1istGanesByDuration(const vectorkCGame2& games, GaneDuration duration)
{
for (const auto& gane: ganes){
If (gane.getDuration()= duration) f
gane.displayO;
}
void CGane::listGanesLomerThanDuration(const
HELP!! Game.h #pragma once #include #include

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!