Allow single play a simple two dice game of chance against

Assignment Help C/C++ Programming
Reference no: EM13166817

Program Specication:

Write a program that allows a single Player (the user) to play a simple two dice game of chance against

"The Odds".

Game Description:

There is a single player, with two six sided die.

The sides of each die are labeled with the numbers from 1 to 6, we will call this the value of the die.

A game is made up of rounds, a single round is played as such:

1. The player rolls their two dice.

d1 = (int)(Math.random() * 6) + 1;

d2 = (int)(Math.random() * 6) + 1;

d1, d2 declared as type int before the game loop.

2. The dice are displayed, in some reasonable format.

3. A determination is made as to whether or not the player won the round, this determination is

made via the following rules:

{ A Pair is when both dice have the same number on their top faces. If the player has any

pair then they win the round.

{ A Straight is when both dice have a dierent number on their top faces - but they are

consecutive numbers. If the player has any Straight then they neither win nor lose the

round.

{ A Junker is then anything that is not a Pair or a Straight. If the player has any Junker

then they lose the round.

4. The result of the round (with respect to the Player) is reported.

The player is asked if they wish to play another round.

Once the player indicates that they do not wish to play another round: Before exiting, the program

displays a short report stating how many rounds were played, of those - how many were won and

how many were lost.

 

Sample run(s):

Welcome to Computer Dice

-------------------------------------

You will first roll your dice

Next the outcome of your roll will

be determined:

any Pair and you Win

any Straight and you just roll again

anything else and you Lose

--------------------------------------

Player

--------

5 1

Sorry, you lose!

Do you wish to play again [y, n] : 5

Do you wish to play again [y, n] : yes

Do you wish to play again [y, n] : y

Player

--------

2 6

Sorry, you lose!

Do you wish to play again [y, n] : y

Player

--------

4 4

Congrats, you win!

Do you wish to play again [y, n] : y

Player

--------

3 2

Its a tie!

Do you wish to play again [y, n] : y

Player

--------

2 3

Its a tie!

Do you wish to play again [y, n] : n

Computer Dice Results

---------------------

You played 5 rounds

Rounds won : 1

Rounds lost : 2

 

 

Reference no: EM13166817

Questions Cloud

How many groups could be formed : A dancehall contains 173 men and 238 women. A certain "promenade" calls for the formation of groups, with each group consisting of one man with two women. a)How many groups could be formed? b) which sex is in excess? By how much? (show calculation..
List and describe at least three prokaryotic cellular featur : List and describe at least three prokaryotic cellular features that could be targeted in this way to inhibit or kill a bacterial pathogen.
Distinct integers that has the following property : You have an array A[0], A[1], ..., A[n - 1] of distinct integers that has the following property:The values in the array increase up to index p for some p between 0 and n - 1, and then decrease for all indices beyond p through positio
How many possible isomers could exist for diacetylferrocene : How many possible isomers could exist for diacetylferrocene? Explain. Calculate the volume of 3M aqueous sodium hydroxide needed to neutralize the acetic and phosphoric acids in the synthesis of acetylferrocene?
Allow single play a simple two dice game of chance against : Write a program that allows a single Player (the user) to play a simple two dice game of chance against
What is the osmotic pressure of a solution : What is the osmotic pressure of a solution made from dissolving 85.0g of glucose in 800ml of water at 19.0 C.
Assume an n × n matrix a is given : Assume an n × n matrix A is given, containing only 1's and 0's, such that, in each row, all 1's come before all 0's. Give an O(n log n) algorithm to count all 1's in A.
Using virtual methods, organize the animals : Using virtual methods, organize the animals in a small zoo, having as guests lions, parrots, alligators, penguins, elephants, cobras, zebras, hawks, turkeys and rabbits.
What percentang of water was in the hydrate : a 5.0 g sample of a hydrate of CaCl2 was heated, and only 4.3 g of the anhydrous salt remained. what percentang of water was in the hydrate?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a function sum3darray

Write a function sum3DArray. This function will take a three dimensional array of ints and add all the entries in the three dimensional array. Assume columns and rank are two constants already defined.

  Function odd_fill() that fills all integers between two poin

write a function odd_fill() that fills all integers between two pointers, first and last, with a sequence of odd integers: 1,3,5,7

  Object-oriented systems is the concept of object

At the heart of all object-oriented systems is the concept of an object. Simply stated, an object is a set of related characteristics and their associated actions.

  Lu decomposition with gauss elimination

The LU decomposition with Gauss elimination and what is the physical interpretation of the elements of ? Write C++ programs for steps 2, 3, and 4.

  Write c program to accept inputs from user

Write down simple c program which accepts following inputs from user that is username and password, it must ask user what he will like to learn today and also ask user to enter char m=math , e= English.

  To use a sentinel loop so once the value of -99 i

modify this program to use a sentinal loop so once the value of -99 is entered after getting the pay and hours the program should end.

  Reverses the characters in a character array

Write the function reverseit that reverses the characters in a character array. You must also write main that calls reverseit.

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

  Write program to declare the array of type float

Write down the c++ program which declares the array of 50 components of type float. Initialize array so that first 25 components are equal to square of the index variable.

  Write a c++ program that prompts the user for a double

Write a C++ program that prompts the user for a double that should be between 0 and 100. If the value entered is outside of the interval the program will print an error message. The program should continue to repeat until the user enters an appropria..

  Write application to calculate price of carpeting for room

The Westfield Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular rooms.

  Program that evaluates a infix expression

Program that evaluates a infix expression using stacks terminated by an equal sign. for example: (4-2)-5)/(2+1)-2))=the expression will contain single digit and the operators +, -, *,/. Make sure to consider the operator precedence.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd