in JAVA Make a dice and roll it n times. In the examples below, n = 100 or n = 10000. n is an user input and it can range between 1 to 1 million. In each run, you have to count how many times each face [1-6] appears, print the probability of each occurrence to check if the random number actually works. Tip: During the early stage of your code development, make your program roll once or 10 times. It will make it easier to debug if there is an issue. If you run your program 100000 times then you will have to wait a long time! After you have ensured that your program works, then you can increase the number of rolls to be 100, or 200 or 10000. Remember, you have to ask the user to enter the value of n. Do NOT hard-code the values yourself in the final program. Comment the  code pleas :) output should look similar to example image

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

in JAVA

Make a dice and roll it n times. In the examples below, n = 100 or n = 10000. n is an user input and it can range between 1 to 1 million.
In each run, you have to count how many times each face [1-6] appears, print the probability of each occurrence to check if the random number actually works. Tip: During the early stage of your code development, make your program roll once or 10 times. It will make it easier to debug if there is an issue. If you run your program 100000 times then you will have to wait a long time! After you have ensured that your program works, then you can increase the number of rolls to be 100, or 200 or 10000. Remember, you have to ask the user to enter the value of n. Do NOT hard-code the values yourself in the final program.

Comment the  code pleas :)

output should look similar to example image

[When the number of rolls is 100]
Occurrence of each face is:
11, 20, 22, 13, 19, 15: 100
Therefore, the probability of each face is:
0.11, 0.2, 0.22, 0.13, 0.19, 0.15
[When the number of rolls is 10000]
Occurrence of each face is:
1667, 1700, 1665, 1683, 1616, 1669: 10000
Therefore, the probability of each face is:
0.1667, 0.17, 0.1665, 0.1683, 0.1616, 0.1669
Transcribed Image Text:[When the number of rolls is 100] Occurrence of each face is: 11, 20, 22, 13, 19, 15: 100 Therefore, the probability of each face is: 0.11, 0.2, 0.22, 0.13, 0.19, 0.15 [When the number of rolls is 10000] Occurrence of each face is: 1667, 1700, 1665, 1683, 1616, 1669: 10000 Therefore, the probability of each face is: 0.1667, 0.17, 0.1665, 0.1683, 0.1616, 0.1669
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education