λFPAI
Practice/Online Shopping Cart with Discounts

Online Shopping Cart with Discounts

Hard

Create a Product hierarchy, a ShoppingCart, and discount strategies (percentage discounts, buy-one-get-one).

Use composition and the strategy pattern so new discount rules can be added without rewriting the cart logic.

OOP Focus: Design patterns basics.

Note: This is statement-only in the current Practice version; stdout should be empty.

Loading editor...

Output

Run or submit to see output.