Question
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
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