Skip to content

Instantly share code, notes, and snippets.

@thilko
Last active January 12, 2019 09:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thilko/2cce5963883855af72067c847c8d87ab to your computer and use it in GitHub Desktop.
Shopping Cart kata
Implement the code for a supermarket checkout that calculates the total price of a number of items. Products can be scanned and at the end a receipt be printed.
1. A product at a time can be scanned. Customer can see a subtotal which shows just the total of all scanned products.
2. Checkout can print a receipt which contains the Product and the price.
3. Multiple products of one type can be scanned, i.e two milks at once.
4. Products can have a price per weight i.e. apples with costs 2.50€/kg.
5. Discount: if a customer buys 2 bottles of milk they get the two for the price of one
6. Discount: if a customer buys 5 bars of chocolate they receive a discount of 10% for the total price of the chocolates
Example products:
Milk -> 1€
Chocolate -> 2€
Apples -> 2.50€/kg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment