A shopping cart

The problem

Build a console shopping cart: products with prices, adding and removing items, discounts and a printed receipt.

Requirements

Technologies

Step by step

  1. Describe the product list and the discount rules in words.
  2. Write the interface and the rule classes, then the Cart class.
  3. Write the command loop for add, remove, discount and receipt.
  4. Test the edge cases: an empty cart, removing too many, two discounts together.

Expected result

A program that prints an exact receipt and rejects every invalid command with a clear message.

How it is evaluated

Ways to improve it