Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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 code

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_2

Step: 3

blur-text-image_3

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

2. Why has the conflict escalated?

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago