Skip to content

This is a code kata in both C# and JavaScript to be used for developer team training.

License

Notifications You must be signed in to change notification settings

stiltet/Shopping-Cart-Discount-Code-Kata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Shopping Cart Discount Code Kata

What is this?

This is a code kata in both C# and JavaScript to be used for developer team training. The code kata are exactly the same in all languages. I use this kata primarly for so called Randori Katas, see more bellow. :)

Shopping cart code kata requirements:

All code should be tested and written with a TDD-approach (test cases first).
The system shall allways chose the best possible discount for the customer.
If multiple discounts are valid shall the system allways chose the largest discount first and there after the other in descending order.

  1. Calculate cart with items price and add a shipping cost of 50SEK.
  2. a) Free shipping when total price of all items in cart exceeds 400SEK.
    b) Free shipping when the cart contains more than 5 different items.
  3. If there are 5+ of the same item there should be a volume discount of 10% that's only valid on that specific item.
  4. Regular custumers gets 10% discount on the whole cart.
  5. Winter holidays sale (Mellandagsrea) 50% on all items in cart between boxing day (26/12) and new years eve. (Can't be combined with 3 or 4)
  6. Expired items with a stock balance of less then 10 gives 40% discount. (Can't be combined with 3, 4 or 5)
  7. Discount voucher gives customers 15% total cart disount on one purchase. (Can't be combined with 4, 5 or 6)

Rules of a Randori Session

  • The presenter explains the coding challenge and devides the group into teams of approx. 5 persons
  • The presenter starts the Randori with a pair from audience.
  • The pair will use TDD (Test-Driven Development).
  • Only one in the pair are allowed to touch the keyboard.
  • One half of the pair is changed every 5 minutes. The one coding goes in the audience and the other part of the pair starts coding with a new partner.
  • The pair on the keyboard should continuously explain what they are doing.
  • The audience are not allowed to intervene in the coding, but are allowed to ask the coding pair questions.
  • The pair coding should stop when someone from the audience falls off the sled — and only continue when that someone is back on track again.

Happy coding! :)

Open source?

This code kata are created by Stellan Lindell. The code kata source code are completly open source and free to use, both for personal and comercial purposes. Licensed under the MIT Licence.

About

This is a code kata in both C# and JavaScript to be used for developer team training.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published