It’s Kataday – Shopping Cart

This week, Emmanuel Valverde has set us another new kata to work through.  Building on last week's kata, ATM machine, he has set us the task of building a Shopping Cart for an online grocery shop.

Once again, the idea is to build this in an iterative way.

You are provided with different products that shoppers can choose from.  You are given the name of the item, its cost to the shop, the percentage revenue / markup on the product, the price per unit (cost + revenue), the tax rate for the item and then the final price to the consumer.

Depending on promo codes, shoppers may get between a 5 and 10% discount.

Customers need to be able can see their cart, add products to it and then obtain a final list of the products they have added (and how many of each), whether there is a promotion, total number of products and total price. 

As this is TDD orientated, the idea is to create this outcome in individual iterations where you start by returning the empty basket, then the customer adds single items to it, gets their total then adds multiples of items and finally you add in discounts.

To add in a challenge (as if you needed it) Emmanuel also suggests writing a possible API for the shopping cart along with the option to add in images or not of the products.

Getting set up can be the roadblock to starting a kata. In our screenkatas you can join our Software Craftspeople and let them show you how to set up your repositories for JavaPHPPython and Typescript. For other languages, check out our guide on GitHub.

Love our #kataday challenges?  Then find them all here and don't forget that our Katalyst portal is filled with programming problems to expand and sharpen your coding skills.