Git Product home page Git Product logo

kata-supermarket-checkout's Introduction

The Supermarket Checkout exercise

This is a variation of a popular kata described in http://codekata.com/kata/kata01-supermarket-pricing/. The aim of the exercise is to build an automated teller that can check out articles from a shopping cart.

The supermarket has a catalog with different types of products (rice, apples, milk, toothbrushes,...). Each product has a price, and the total price of the shopping cart is the total of all the prices.

But the supermarket also runs special deals, e.g.

  • Buy two toothbrushes, get one free
  • 10% discount on rice
  • 20% discount on apples if you buy more than 10
  • Bags of 1 kg of oranges $4 instead of $5.

These are just examples: the actual special deals changes each week, so needs to be easily configurable.

Goal

The goal of the exercise is to implement a teller that can handle the following scenarios (and more - use your imagination!)

  • The teller should be able to handle a shopping cart with no special deals

  • The client should get a receipt with the list of purchases and the total price.

  • The teller should be able to handle the following scenarios

    • Buy 2 get one free
    • Buy 4 get one free
    • 10% discount on a certain product (e.g. 10% discount on 1kg packets of rice)
    • 20% discount on a certain product if you buy more than 10 (e.g 20% discount on apples for 11 or more apples)
    • Fixed discounts (e.g. bag of 1kg of oranges costs $4 instead of $5).
  • The teller should be able to handle combinations of the above scenarios, when there is more than one special deal in the shopping cart items.

There is a simple failing test in WhenCheckingOutArticlesAtTheSupermarket to get you started.

kata-supermarket-checkout's People

Contributors

wakaleo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.