Session 11

Last time I started with :

I propose that we write a piece of code that rolls two 8-sided die and observes their sum - repeated 1000 times.  Thus, we want to record the frequency with which we see each of the possible sums from 2 - 16.

Let's extend that a bit:

I propose that we write a piece of code that rolls N dice of varying numbers of sides, provided by the user at run-time and observes their sum - repeated M number of times, also a value provided by the user.

While we could do this using some sort of run time I/O, let's do it by using run-time/command-line arguments such as by saying:

java DieTester 8 8 10 15 100000

which would roll four dice - with 8, 8, 10, and 15 sides respectively - a total of 100,000 times

 

Things that we deal with when writing this code: