Re: .98 cents instead of .99



You have run into a bad case of rounding error. doubles are not exactly
the number you wish to represent, and thus, amountPaid - totalCost may
be a tiny bit less then 9, which gets rounded down to 8 by the int cast.

.