Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming problem, having some issues. Write a Java program that simulates a dice game. Prompt the user for a betting balance. Then start the

Java Programming problem, having some issues.

Write a Java program that simulates a dice game. Prompt the user for a betting balance. Then start the game. Prompt the player for a bet amount. The amount has to be less or equal to the bet balance. The player cannot bet with a $0 balance. If the player rolls two dice that sum anywhere between 2 and 6 the player wins the bet, and the bet amount is added to the betting balance. If the player rolls a total between 7 and 12 the player loses, and the bet amount is subtracted from the betting balance. After each roll the player is asked if they want to continue playing. If they decide to stop display the ending balance with a friendly message. If the balance is greater then what they started with congratulate them on winning. If the amount is less than what they started with display a message that wishes them better luck next time. You are required to implement and call a method to roll a six sided. Name the method RollDie. The RollDie method has a return type of int, and has no parameters. If the use enters an invalid bet your program will display a message letting the user know, and prompt again for a valid bet. If the user enters three invalid bets in a row the user is asked to leave the casino, and the game ends. The final balance should still be displayed.

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

Students also viewed these Databases questions

Question

Question Can employees make contributions to a profit sharing plan?

Answered: 1 week ago