Question
Provide a game solution using C++ language, develop solutions that use class features for C++. Create *.h files and *.cpp files for classes, and write
Provide a game solution using C++ language, develop solutions that use class features for C++. Create *.h files and *.cpp files for classes, and 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started