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
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?
|