Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please USE JAVA to write the following code: ( DO not use break or continue in the code ) . Program - > Write a

Please USE JAVA to write the following code: (DO not use break or continue in the code). Program -> Write a program that simulates throwing a die n times. You can assume n to be an integer that is 1 or greater. The program will read the number of times to throw the die and display the throws. Each throw is represented by 9 characters where we use 0 or .(see sample run below). To generate random values, you need to create a Random object with a seed value that corresponds to the number of dies to throw. Use the method nextInt (with 6 as the argument) in order to generate integer random values between 0 and 5. Just add 1 to the result to generate the die face. The following example illustrates the messages to use to read data and to display results: How many times to throw a die?: 14
Throw #1
0.0
0.0
0.0
Throw #2
...
.0.
...
Throw #3
0.0
0.0
0.0
Throw #4
0.0
0.0
0.0
Throw #5
0..
.0.
..0
Throw #6
0..
.0.
..0
Throw #7
0..
.0.
..0
Throw #8
0.0
0.0
0.0
Throw #9
0..
...
..0
Throw #10
0.0
...
0.0
Throw #11
0.0
...
0.0
Throw #12
0.0
0.0
0.0
Throw #13
0.0
.0.
0.0
Throw #14
0..
.0.
..0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

What is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago