
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Write a segment of Java code that repeatedly rolls two dice, keeping the following statistics:
Your code segment should roll the pair of dice 1000 times, and produce the following output.
Die 1 had larger roll ??? times Die 2 had larger roll ??? times Two dice had same roll ??? times
You may assume that you have available the Dice class that we have defined previously (which of course has the roll() method).
How would you change your code to repeatedly roll the dice until one of the two dice has had the larger roll 500 times? What about until both dice have had the larger roll 500 times?
Protocol