added var for totalCost

added var for total cost, tested and works in index.html