heartRate = targetHeartRate(heartRate);

Check the definition of targetHeartRate(). It's not accepting boolean anywhere. You must be able to trace the error on your own.
targetHeartRate() is...