Question
JAVA PROGRAM Write a program named roll.java that simulates rolling a pair of dice 10,000 times. It should track how many times each number (total
JAVA PROGRAM
Write a program named roll.java that simulates rolling a pair of dice 10,000 times. It should track how many times each number (total of dice 2 - 12) is rolled. Total On Dice Number of Rolls ------------- --------------- 2 274 3 520 . . . . . . 12 281
Hint: Create a 13 element int arrary to store the number of rolls of each value 2 - 12. Create a loop that executes 10,000 times. Inside the loop, pick 2 random numbers 1-6. Add the 2 numbers and increment to corresponding array element. After the main loop, output the values of array elements 2 - 12.
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