It's the order of operations.

(double) (total/10) evaluates as such:

1. take the integer total and divide by the integer 10. This is an integer number.
2. Cast that number to a double. An...