Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions