In Java, integer division truncates toward zero. Z is an int, 100 is an int, so z / 100 performs z div 100. For 34/100, that gives zero. If you cast the first number to a double and save it to a double, it should perform the division (which wasn't what the instructions said, but the instructions may have been intended as an object lesson about integer division).
No comments:
Post a Comment