Change return type of calculateWeight() to double, to match X and Y coordinate types.