Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java please with explanations. This program will require you to generate random numbers between 1 and 6, and to do some operations within a

in java please with explanations. image text in transcribed

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 16 2 2 You threw a pair! 3 2 42 45 The average is 3.1

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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

Question Can a Keogh plan fund be reached by the owners creditors?

Answered: 1 week ago

Question

Question What happens to my plan if I die?

Answered: 1 week ago