Find Us On:

# Java - Dice roll game

deybling

Note:Need to use arrays and Joptionpane =============================== Create an application that simulates the outcome of a dice game that Runs the simulation 1 million times. Do not report results until the simulation has ended. Reports the number of times the game results in a roll of 5-of-a-kind , 4 of a kind. Calculate the expected value of a single game that is played when the pot has \$865 in it, and the cost of a frosty mug of Fat Tire is \$3.50. Expected value is the sum of the probability of each outcome multiplied by the benefit of each outcome. That is, a. (prob of win * \$865) + (prob of free drink * \$3.50) Rules of the dice game: 1. The game is played with 5 dice 2. All the dice are rolled on each turn 3. Each game consists of 3 turns, unless a. A roll of 3-of-a-kind does not count (a free turn) b. A roll of 5-of-a-kind immediately ends the game 4. A roll of 4-of-a-kind results in a free drink for the player. Evaluation criteria 1.All tasks must be completed to receive credit for this assignment 2. Program should report the correct values a. Including free rolls, there are about 3.71 rolls per game b. The game should produce ~2850 wins c. You should get ~71,000 free drinks. Attachments Tags Clarifications

## Java - Dice Roll Game - Solution

dickersonka

Attached is the solution to the Java - Dice Roll Game including source and comments. Attachments
DiceGame.zip (18 K)
Preview
remaining rollRemaining--; //increment free drinks numFreeDrinks++; break; case 5: //increment number of wins numWins++; //game over rollRemaining = 0; break; default: //decrement rolls remaining rollRemaining--; break; } //increment total number of rolls

Preview

Screenshots