You are accumulating into an int. Total is an int, and the methods return type is int.

In other words, change the return type to double, and the total into double.