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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started