I didn't say anything about order of operations.
3 / 5 = 0
3.0 / 5.0 = 0.6
Both variables need to be converted to floating point values before they can be divided. To get an integer as an output you would need to do this:
PHP Code:
new percent = floatround(float(earned)/float(total)*100.0)
__________________