Question: Provide a game solution using C++ language. Develop solutions that use class features for C++. Create *.h files and *.cpp files for classes. Write code

Provide a game solution using C++ language.

Develop solutions that use class features for C++.

Create *.h files and *.cpp files for classes.

Write code for the class GamePurse.

a. It has the following interface

class GamePurse

{

int purseAmount;

public:

GamePurse(int);

void Win(int);

void Loose(int);

int GetAmount();

};

b. Win() function will add a winning amount to the purseAmount. On the other hand,

Loose function will deduct an amount from the purseAmount. GetAmount() will return

the value of purseAmount.

c. Write a program that allows you to play the dice game repeatedly until the user chooses

to quit. User needs to bet a positive amount to play a game.

d. The output of the program may be like the following

Welcome to the diceware game. You have 100 in your game purse.

Enter a bet amount to play (0 means exit the program):

10

Your dice is 5

Computer dice is 3

You won 10 dollars!

Your game purse now has 110 dollars

Enter a bet amount to play (0 means exit the program):

5

Your dice is 4

Computer dice is 6

You lost 5

Your game purse now has 105 dollars

Enter a bet amount to play (0 means exit the program):

0

You choose to exit the program. Thank you and goodbye.

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!