Question: This program will require you to generate random numbers between 1 and 6, and to do some operations within a loop. The program should: 1.

This program will require you to generate random numbers between 1 and 6, and to do some operations within a loop.

The program should:

1. Prompt the user to enter how many times he/she would like to throw the dice.

2. Accept an integer n

3. Throw two dice n times. Use a random number generator (import java.lang.Math.Random see the link on Moodle) to generate the values of the dice.

4. Output the values of each throw on a separate line. Use printf to format your output. Make the output clear and easy to understand for the user.

5. If the throw is a pair, include that in the output.

6. Print one blank line, and then output an average of the values of all the dice.

Example: >How many times would you like to throw the dice? 5

1 6

2 2 You threw a pair!

3 2

4 2

4 5

The average is 3.1

This needs to be written in Java please

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!