CS 122 - Day 17 Exercises
This page lists some problems for today's class. After today, you should be able to solve these problems on your own. Problems with this color are more challenging.
Create a SixSidedDie class similar to the one in chapter 10. Give it roll() and getValue() methods. Use the double underscore technique for hiding the internal state variable that stores the most recent roll.
Use the SixSidedDie class you created in problem 1. Create two SixSidedDie instances, roll them both and record the result when adding their values together. Repeat this process 100 times keeping track of how frequently each value is rolled. Print out the results and and then check to see whether the frequencies you got for each value correspond to what you would expect from real dice. You should be able to find the probability of each value somewhere online.