Kata: Shopping Cart Easy-Medium
Let’s implement the code for an online fruit & veg shop checkout that calculates the total price of a number of items.
Our goods are priced individually. In addition, some items are multi-priced: buy n of them, and they’ll cost you y cents. For example, item ‘Apple’ might cost 50 cents individually, but this week we have a special offer: buy three ‘Apples’ and they’ll cost you $1.30. The current specials are:
Apple 50 3 for 130
Banana 30 2 for 45
Carrots 20
Design an app that allows items to be added to a cart and checked out. The customer needs to know the total of the items each time an item is added to the cart.
You can think about how to manage stock outages, checking out and other activities one carries out in an online store.
Original link [Be careful not to review answers until you’ve completed your answer] http://codekata.com/kata/kata09-back-to-the-checkout/