Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language: C++ Create *.h files and *.cpp files for classes. File 1: Class Specification (GamePurse.h) File 2: Class Implementation (GamePurse.cpp) File 3: Test File (GamePurseTest.cpp)

Language: C++

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

File 1: Class Specification (GamePurse.h) File 2: Class Implementation (GamePurse.cpp) File 3: Test File (GamePurseTest.cpp)

Assignment:

a. Write code for the class GamePurse. 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 dice war 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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

10. Why is it important to check cultural generalizations? (LO 7-7)

Answered: 1 week ago