added totalCost

cleared up and finished totalCost