changed ttotalCableneeded function to return a double.