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. :)
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.
- Calculate cart with items price and add a shipping cost of 50SEK.
- 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. - If there are 5+ of the same item there should be a volume discount of 10% that's only valid on that specific item.
- Regular custumers gets 10% discount on the whole cart.
- Winter holidays sale (Mellandagsrea) 50% on all items in cart between boxing day and new years eve. (Can't be combined with 3 or 4)
- Expired items with a stock balance of less then 10 gives 40% discount. (Can't be combined with 3, 4 or 5)
- Discount voucher gives customers 15% total cart disount on one purchase. (Can't be combined with 4, 5 or 6)
- 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.
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.