Question: Done in C++ Please I need the .cpp files made for the given .h files. The main function has yet to be built but I

Done in C++ Please

I need the .cpp files made for the given .h files.

The main function has yet to be built but I only need the class functional

GENERAL RESTRICTIONS

No global variables

No labels or go-to statements

No infinite loops, examples include:

for(;;)

while(1)

while(true)

do{//code}while(1);

No break statements to exit loops

Done in C++ Please I need the .cpp files made for the

given .h files. The main function has yet to be built but

//copyable code//

#ifndef Game_h

#define Game_h

#include

#include

#include

using namespace std;

class Game

{

public:

Game();

//default constructor

//Postcondition:

/*

userName = "";//variable to store the user name

totalWages = 0;//variable to store the total earning

totalCorrect = 0;//variable to store the total of correct responses

totalWrong = 0;//variable to store the total of incorrect responses

*/

void splashScreen ();

//Function to display credits and developer information.

void menu();

//Function to display the menu options and validate them.

void updateStats(bool correct);

//Function to update game statistics

//Postcondition: updates totalWages and totalCorrect and totalWrong;

void displayStats();

//Function to display player statistics

void requestName();

/*

Function to get userName

This function also invokes the validate method which ensures that the

userName is valid; that is, it is not numbers, blanks, non-alpha chars or

a combination thereof

Postcondition: creates a new text file if user is a first-time player or

reads statistics from text file if user is a returniong player

if the player is a "returning player", the statistics are read into:

userName, totalWages, totalCorrect, and totalWrong

*/

void saveStats();

//Function to save statistics into text file

//Postcondition:statistics saved are: userName, totalWages, totalCorrect, and totalWrong

void validate(string& str1);

//Function to validate userName

//userName is not allowed to be more than one word or numbers, blanks, non-alpha chars or a combination thereof

//Postcondition: userName is a single word made of alpha chars only

private:

string userName;//variable to store the user name

double totalWages;//variable to store the total earning

int totalCorrect;//variable to store the total of correct responses

int totalWrong;//variable to store the total of wrong responses

const double REWARD = 0.05;//constant to store 0.05 as a reward for every correct problem

const double PENALTY = 0.03;//constant to store 0.03 as a penalty for evry wrong problem

ofstream outData;//used to open file for saving stats

ifstream inData;//used to open file for retrieving stats

};

#endif

/////Additoional info about Program/////

Your task is to develop a program that will teach youngsters the basic math facts of addition, subtraction, multiplication and division. The program generates random math problems for students to answer. Students get a small reward for correct answers and suffer a small penalty for incorrect ones. User statistics need to be recorded in a text file so that they may loaded back into the program when the student returns to play the game again. In addition, the youngster should be allowed to see how (s)he is doing at any time while (s)he is playing the game. One of the MAJOR objectives of this assessment is for you to demonstrate your ability to use classes.

1 #ifndef Game h 2 #define Game h 4 5 #includestring> 6 #include iostream 7 #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 Databases Questions!