Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help in Java: Using (while in loop) We will simulate a dice game in which 2 dice are thrown. If the roll is 7

Please help in Java: Using (while in loop)

We will simulate a dice game in which 2 dice are thrown.

If the roll is 7 or 11, you win. If the roll is 2, 3 or 12, you lose. If the roll is any other value, it establishes a point. If with a point established, that point is rolled again before a 7, you win. If, with a point established, a 7 is rolled before the point is rolled again you lose.

Build your algorithm incrementally. First write a program that simulates a roll of two dice, then outputs if it is a simple win (7 or 11), or a simple loss (2 or 3 or 12), or something else. Now fix the part where we wrote something else. In this case, we rolled a number which we called total. We need to keep rolling the dice and looking at the new total each time. If the new total is the same as the total, we win. If the new total is 7, we lose. And if something else we roll again

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

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago