I make a first method for calculateCost