Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program using Java that creates an array of ints to count the times a face of a die is rolled. Use this code

Write a program using Java that creates an array of ints to count the times a face of a die is rolled. Use this code to roll the die: int face = (int)(Math.random()*6+1);. This code will return a number between 1 and 6, inclusive (to make it return a number between 0 and 5, remove the +1 part). Write a loop that rolls the die 36000 times and counts the value of the face that is rolled. In another loop, output the face number and the accumulated count for it. The program must use an array and must use array operations; a chained else or switch must not be used to obtain the counts.

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_2

Step: 3

blur-text-image_3

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

What are the advantages and disadvantages of flextime?

Answered: 1 week ago

Question

What could Kathy have done to keep the situation from occurring?

Answered: 1 week ago

Question

How can Seaview improve their benefits communication? Discuss.

Answered: 1 week ago