Question: Program in java A gambler approaches you to determine if they will make money on playing a dice game. The game consists of betting $1.

Program in java Program in java A gambler approaches you to determine if they will

A gambler approaches you to determine if they will make money on playing a dice game. The game consists of betting $1. They then throw a single six-sided die three times. If they throw a six (6) on at least one of those throws, they win a $1. If not, they can play again. NOTE: The player doesn't get more than $1 if they throw more than one 6 per game. "At least one 6" means one or more. a) Set up this game. The game should generate a random number between 1 and 6 to represent the die value. Display each of the three throws. If the player wins, add to their total winnings (a running total). If they player loses, subtract from their total winnings. Allow them to determine whether to continue playing. You should accept an upper or lowercase y for a yes answer. A sample interaction when I played is displayed below. Roll # 1: You rolled a 2 Roll # 2: You rolled a 1 Roll # 3: You rolled a 6 You won! Total so far: $1.00 Do you want to play again? (Y/N) => Y Roll # 1: You rolled a 2 Roll # 2: You rolled a 6 Roll # 3: You rolled a 1 You won! Total so far: $2.00 Do you want to play again? (Y/N) >> Roll #1: You rolled a 6 Roll # 2: You rolled a 2 Roll # 3: You rolled a 5 You won! Total so far: $3.00 Do you want to play again? (Y/N) -> y Roll # 1: You rolled a 1 Roll # 2: You rolled a 2 Roll #3: You rolled a 2 You lostl Total so far: $2.00 Do you want to play again? (Y/N) -> L b) Answer the original question. When the player chooses to end the game, you should have the computer play 100,000 games and generate the number of times the player would have won and the number of times they would have lost. Do you want to play again? (Y/N) -> If you played 199,000 times, you would have won 42,457 times and you would have lost 57,543 times

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!