fixing method calculateTotalAmount