compareTotalCost: return an int