Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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

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
Check Mark
Step 1

Use of Java:

Java is used by developers to create applications for laptops, data centers, game consoles, scientific supercomputers, cell phones, and other devices. According to the TIOBE index, which ranks programming language popularity, Java is the world's third most used programming language, trailing only Python and C.

Knowledge Booster
Background pattern image
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
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education