Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please help me with this project in C++ Programming!!!! I must create a dicegame and there are particular requirements I have to follow

Can someone please help me with this project in C++ Programming!!!! I must create a dicegame and there are particular requirements I have to follow which are:

1. Introduction

This project requires students to create a design for a Dice Game and then implement it in C++. This Software Requirements Specification (SRS) document will outline all the features required of the system.

1.1 Purpose

The purpose of this simple SRS is to provide all the basic requirements necessary to complete Software Design Specification (SDS) to implement the system.

1.2 Scope

The game will be written with one or several functionalities:

a. One player against computer 200 pts. (one player vs. computer)

The software to be created will be a stand-alone PC representation of the hand game called DiceGame, implemented with C++. It will have one human players and a computer acting as the casino.

2. General Description

When user(s) starts the program, he will be prompted for the names of the human player. These values will be used for all prompts and statistics in the program.

Then there will be a menu with the following selections: 1. Play game, 2. Show game rules, 3. Show statistics, and 4. Exit in that order. Rules selection will provide rules of the game, statistics will show the accumulative wins, loses, for the player, and exit will close the program.

When play game is selected, the player will roll the dice. The player will be playing against the computer. Players will start with $1000. A game will consist of as many rounds as the player chooses OR until he is out of money. After each round the player is told whether he won or lost and the dollar amount he has in the bank is displayed. User(s) will be able to run multiple rounds and their wins/loses will be displayed in the statistics option along with the overall money he has left.

2. 1 Product Functions/Requirements Flow

Below are all the basic requirements the system must satisfy

2.1.1 Initial screen

2.1.1.1 Description

When program starts, it needs to prompt user for the name of the human player.

2.1.1.2 Stimulus/Response Sequences

User starts the program, prompt is displayed and user has to respond before program goes on.

2.1.1.3 Functional Requirements

[R1.1] User must be prompted with the following message What is the name of the player? and then after correct response is supplied.

[R1.2] User must type a string no longer than 20 characters and no less than 5 characters. For invalid input, program must issue an error message and re-prompt. (HINT use the string type and look in the text pp. 492 505)

[R1.4] Program will use the saved input value for prompting player to roll the dice and his winnings/losses.

[R1.5] Once correct response is given; program will display the menu.

2.1.2 Menu

2.1.2.1 Description

Program needs to display a menu with 4 selections: 1. Play game, 2. Show game rules, 3. Show statistics, and 4. Exit in that order.

2.1.2.2 Stimulus/Response Sequences

User correctly provides player name, menu is displayed, and user may select one of the 4 options.

2.1.2.3 Functional Requirements

[R2.1] Menu must be displayed correctly with provided naming of menu choices and in correct order and user can select one of the options by typing the corresponding number and pressing return.

[R2.2] Show rules selection must display all the rules for the game (see Rules requirement below for details) and how user can win. User will be able to return to the menu.

[R2.3] Statistics selection will display the accumulative statistics per round. User will be able to return to the menu.

[R2.4] Exit selection must end the program with a Goodbye message.

[R2.5] Play selection will allow the user to play the game. Once game is completed, user will be able to return to the menu.

[R2.6] If user makes an invalid menu selection, error message will be displayed and user will be prompted again.

2.1.3 Statistics

2.1.3.1 Description

Program needs to keep track of the statistics.

2.1.3.2 Stimulus/Response Sequences

User selects 3. Show statistics from the menu

2.1.3.3 Functional Requirements

[R3.1] Statistics selection will display the round, the amount won, or the amount lost and how much money is left in the bank. NOTE: The user can choose to quit or play until he is out of money.

Round Won Lost Bank

1 100 1100

2 200 900

3 50 950

4 100 850

[R3.5] The statistics are accumulative until users exit the program.

[R3.6] On start of the program, all statistics are 0, and the user will be given $1000.

2.1.4 Play game

2.1.4.1 Description

Player will be allowed to roll the dice.

2.1.4.2 Stimulus/Response Sequences

Play game is selected from the menu.

2.1.4.3 Functional Requirements

[R4.1] When game starts, the player shall be asked to place a wager. A wager must be a minimum of $10.00 and must be in whole dollar amounts.

[R4.2] The wager has to be less than or equal to the amount the player has in his bank.

[R4.2.b] The player shall roll the dice.

[R4.3] For the player, program displays whether the player won, lost, or has to match the point.

[R4.4] If the player wins or loses the amount in his bank is adjusted accordingly and he is shown the amount now in the bank. i.e., You have $800.

[R4.5] A player can choose to quit at any time or until he is out of money.

[R4.7] If a user ends the game, the user is able to go back to menu where they can again select one of the options.

[R4.8] Users can play as many games as they want OR until they are out of money.

2.1.5 Rules

2.1.5.1 Description

Rules of the game will be displayed and used to determine the winner.

2.1.5.2 Stimulus/Response Sequences

User selects 2. Show game rules and is given the rules or program need to determine a winner.

2.1.5.3 Functional Requirements

[R5.1] Winner of the round will be determined as follow:

a. Player roll a 7. He wins double the amount wagered.

b. Player rolls a 2, 3 or 12 Player loses the amount wagered

c. Player rolls any other value and that becomes the POINT

1. Player rolls and matched the POINT Player wins

2. Player roll a seven (7) before he matches the POINT player loses.

[R5.4] The above rules will be displayed to the user

2.2 Functions / Objects

2.2.1 The software must have at least the following functions as follow:

1. DiceGame This function will call the rollDie and get the total of the two die. Based on the roll the function will either:

a. Set gameStatus to WON

b. Set gameStatus to LOST

c. Set gameStatus to CONTINUE

i. Whlie gameStatus is set to CONTINUE, the player will roll the dice until they roll a 7 (LOSS) or match the POINT (WIN).

2. DiceGameDriver This function will create the Player instance and set his BANK to $1000.

This function will prompt the player for their name and check that it is a valid player name.

3. Player

a. This function will call the DiceGame function. If the player WON, his bank balance is incremented by the appropriate amount. If the player LOST his bank balance is reduced by the amount of the wager.

b. This function will display the new BANK balance if positive and greater than or equal to $10.

c. This function will display the BUSTED BANK balance if BANK is less than $10.

d. This function will prompt the user if he wants to keep playing the game.

4. Wager This function will prompt the user for a wager amount. The amount must be less than or equal to the BANK and not less than $10.00.

5. GetStatistics stores and displays all stats information for a single player (round wins, losses, remaining BANK amount).

2.2.2 Each function must be in a separate file. You will also have a header file to hold any global identifiers and function declarations. Files should have the same name as the function name.

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago