Shopping cart pricing with category coupons
A shopping cart holds items, each with a category and a price. A coupon names a category and gives a percentage or amount off, and it applies only when the cart meets its conditions: a minimum number of items and a minimum total price (in that category). Model items, the cart and coupons, and write the function that computes the cart's final price with the coupons applied. Discuss how you would add new coupon rules without rewriting the pricing code, and how several coupons interact.
No answer yet. Write the first one; the best answer gets endorsed.
