Calculating discounts and total cost