Git Product home page Git Product logo

clamcard-kata's Introduction

ClamCard

Implement a system for a contactless travel card for the London underground.

  • The card does not need to be topped up.
  • The card charges the owner's bank account directly when used.
  • The card is used by touching in and out at train stations.
  • The train system accepting this card has two categorical zones of stations, Zone A and Zone B.
  • The stations within the zones are as follows:
Zone A Zone B
Asterisk Bison
Antelope Bugel
Aldgate Balham
Angel Bullhead
Aardvark Barbican
  • Travelling within Zone B is more expensive than travelling in Zone A.
  • The price of Zone B is inclusive of travelling within Zone A.

The fares are as described below:

Single Day Week Month
Zone A £2.50 £7.00 £40.00 £145.00
Zone B £3.00 £8.00 £47.00 £165.50
  • A Single is a journey from one station to another
  • A Day fare includes all single journies made within a single day.
  • A Week fare includes all single journies made within a single week.
  • A month fare includes all single journies made within a single month.
  • If one of the stations is within Zone B at any point in a journey, the price for Zone B will be charged.
  • No matter how many journies are made within one of the time boundaries within a particular zone, the price will cap at that time period's fare.

User Stories

Please implement the following:

Given Michael has a ClamCard,
And Michael travels from Asterisk to Aldgate,
Michael will be charged £2.50 for his journey.

Given Michael has a ClamCard,
And Michael travels from Asterisk to Barbican,
And Michael travels from Barbican to Balham,
Michael will be charged £3.00 for his first journey
And a further £3.00 for his second journey.

Given Michael has a ClamCard,
And Michael travels from Asterisk To Barbican,
And Michael travels from Barbican to Balham,
And Michael travels from Balham to Bison, Michael will be charged £3 for his first journey,
And a further £3.00 for his second journey,
And a further £2 for his third journey. (As he will have reached his day cap)
And a further £0.00 for any additional journies within the day

Credit for the original design of this kata to Amir Bazazi

Bonus scenarios here

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.