Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please help with this code This problem uses while and/or do while loops to implement a simple dice game. Some of the Dice code is
please help with this code
This problem uses while and/or do while loops to implement a simple dice game. Some of the Dice code is provided to you, which will teach you a bit about random number generation and Java's switch statement. The steps of the game are these: 1 Tell the user we're playing a game. Print the string "Let's roll the dice. 2. Prompt the user for a number in the range 2.12 inclusive. 1. Prompt with the string What number do you want [in 2.12)? 2. As long as the user puts in a number outside the [2.12] range, keep prompting. 3. When you get a number in the range [2.12], store it in an int variable you declare for this purpose. 3. Use the die.roll() method to get two random numbers in 1.6 range. Store them and compute their sum. Print out the two dice face pictures and the sum [with " space separating them). Use die. get Diest ring ( ) method. 5. If the sum of rolls matches the user's number, you're done. If not, go back to #3 and roll again. 6. Steps 3 through 5 probably need a loop. Warning: You must use the die variable that's already created in main(). It gives pre-loaded dice whose random numbers can be controlled for testing purposes Otherwise the tests will fail even on working codeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started