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
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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4eaca33a-bcfa-4336-aecf-f320ab80f63b%2F87bb3e06-4d99-4fef-af27-2c2620fa928c%2Fml059k8_processed.png&w=3840&q=75)

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.
Step by step
Solved in 4 steps with 4 images









