Question: 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

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!