Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

blur-text-image

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions