Question: (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
(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
Get step-by-step solutions from verified subject matter experts
