Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Dice2) Go back to program Dice you wrote previously. Recall that in this program you counted the number of times I was rolled, 2 was

image text in transcribed
(Dice2) Go back to program Dice you wrote previously. Recall that in this program you counted the number of times I was rolled, 2 was rolled, etc. In order to maintain a count of the number of each type of roll you used 6 different variables. Rewrite your code so that you use a built-in array to keep track of the number of each type of roll. HINT: uses an array named roll ) in which the index represents the result of the roll and the array element contains the count of number of times that number has been rolled. Utilize the random method in the Math class for selecting a random number from 1 to 6. Sample Output: How many rolls? 100 There were 100 rolls of the die. 1's: 16 23:15 3'3: 20 4's: 16 5's: 12 6's: 21

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions