Question: Java: While Loop For Loop Random Number Generator Programming Activity Description: This lab requires you to simulate the rolling of two dice. Two dice consisting

Java:

While Loop

For Loop

Random Number Generator

Programming Activity Description: This lab requires you to simulate the rolling of two dice. Two dice consisting of 6 sides are rolled. Write a program that simulates this. The user will be asked if he/she wishes to continue the roll of dice. If the answer is, Y or y, then your application will continue to roll the two dice. Each roll of the dice mustoccur6 times, each time the user agrees to continue (see sample output). Use a for loop in order to keep track of the number of times the dice are rolled. You can name your program RollDiceTimes.java See sample output below.

Sample Output:

H:\>java RollDiceTimes

Rolling the dice...1

Their values are:

2 6

Rolling the dice...2

Their values are:

2 2

Rolling the dice...3

Their values are:

3 6

Rolling the dice...4

Their values are:

6 3

Rolling the dice...5

Their values are:

6 4

Rolling the dice...6

Their values are:

6 2

Roll them again (y = yes)? y

Rolling the dice...1

Their values are:

4 4

Rolling the dice...2

Their values are:

3 3

Rolling the dice...3

Their values are:

3 2

Rolling the dice...4

Their values are:

1 4

Rolling the dice...5

Their values are:

5 1

Rolling the dice...6

Their values are:

3 6

Roll them again (y = yes)? n

H:\>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!