Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stuck on this program in Java, please help as soon as you can. You will write a game. The game starts by giving the player

Stuck on this program in Java, please help as soon as you can.

image text in transcribed

You will write a game. The game starts by giving the player $500. The game prompts the player for the amount they want to bet, and the sum of two randomly rolled dice. If the player guesses the sum correctly, the player wins some money based on the rules below. If the player guesses wrong, the player loses the amount that was bet. The game repeats until either the player runs out of money, or the player chooses to stop playing. Here are the rules for winning and losing. - If the sum matches the sum of the dice, and the two dice have the same value, the winning amount is twice the bet. For example, if the player bets $100, and the player guesses four as the sum, and the first die is two and the second die is two, then the player is awarded $200, which is twice the bet of $100. - If the sum matches the sum of the dice, but the two dice have different values, then the winning amount is the same as the bet. - If the player guesses the wrong sum, they lose the amount equal to the bet. - Make sure the player does not bet more than they have, or a negative amount. If the amount is negative or greater than the amount they have, ask the player to reenter the bet. - Make sure the player types Y,y,N or n when prompted to continue the game. If the player enters anything else, the game should ask the player to reenter the answer. You will write a game. The game starts by giving the player $500. The game prompts the player for the amount they want to bet, and the sum of two randomly rolled dice. If the player guesses the sum correctly, the player wins some money based on the rules below. If the player guesses wrong, the player loses the amount that was bet. The game repeats until either the player runs out of money, or the player chooses to stop playing. Here are the rules for winning and losing. - If the sum matches the sum of the dice, and the two dice have the same value, the winning amount is twice the bet. For example, if the player bets $100, and the player guesses four as the sum, and the first die is two and the second die is two, then the player is awarded $200, which is twice the bet of $100. - If the sum matches the sum of the dice, but the two dice have different values, then the winning amount is the same as the bet. - If the player guesses the wrong sum, they lose the amount equal to the bet. - Make sure the player does not bet more than they have, or a negative amount. If the amount is negative or greater than the amount they have, ask the player to reenter the bet. - Make sure the player types Y,y,N or n when prompted to continue the game. If the player enters anything else, the game should ask the player to reenter the

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions