Question text is in black, my answers in blue. No, you can
implement this with variables. The numerical precision problem
is that the true probabilities are fractions and the double
values you'll use are thus approximations. When you add up lots
of numbers that are slightly off, the errors can accumulate. But
here you are only adding a few thousand numbers and the error
shouldn't be significant. The problem of integer overflow is
that if you deal with numbers larger than 2 billion or so the
computer wraps around and gets wrong answers. I don't see why
you would want such large numbers for this problem, particularly
if you deal with all the probabilities double values, but in any
case we won't worry about overflow when grading your paper code.
No, for the homework you can assume that you have a package
lying around that does all this stuff, so you can just call
methods like However, coding up these methods on your own is a
good way to internalize their definitions, and would be fair
game as a test question! bi