Coder Social home page Coder Social logo

bbc-coin-test's Introduction

BBC Coin Algorithm Test

DEVELOPER ASSESSMENT

Summary

Write a simple application that given a number of pennies will calculate the minimum number of Sterling coins needed to make that amount.

Eg. 123p = 1 x £1, 1 x 20p, 1 x 2p, 1 x 1p

You should be prepared to spend at least two hours on it.

Requirements

  • Account for only the common £2, £1, 50p, 20p, 2p and 1p coins. Ignore those commemorative £5 coins.
  • You MUST use JavaScript (node.js is allowed too!), CSS and HTML to do this.
  • The user interface should consist of a input field that accepts an 'amount' string (Eg. 92p, £2.12) and displays the denominations needed when the user hits 'enter'.
  • Include any instructions, libraries, build files in order for us to run & view your code.
  • If you run out of time include a note of things you would like to have done in a README file.

What we are looking for

  • High quality and maintainable code.
  • Accessible, semantic, valid HTML.
  • Unobtrusive JavaScript.
  • Test cases for your code (Eg, Qunit, Jasmine), written first!
  • Well documented and commented code.
  • Follow coding standards.
  • Extensible user input parsing and validation.
  • To sensibly separate functionality (Eg, input, models, utils, views) following OO patterns.
  • Clean visual design.

Test Data

Our business analyst has given us some test data to help you understand the expected user input to this application.

In the first column is a string of user input, and in the second the desired integer expressed as pence.

| input | pence (canonical) | description |
| 4 | 4 | single digit |
| 85 | 85 | double digit |
| 197p | 197 | pence symbol |
| 2p | 2 | pence symbol single digit |
| 1.87 | 187 | pounds decimal |
| £1.23 | 123 | pound symbol |
| £2 | 200 | single digit pound symbol |
| £10 | 1000 | double digit pound symbol |
| £1.87p | 187 | pound and pence symbol |
| £1p | 100 | missing pence |
| £1.p | 100 | missing pence but present decimal point |
| 001.41p | 141 | buffered zeros |
| 4.235p | 424 | rounding three decimal places to two |
| £1.257422457p | 126 | rounding with symbols |

Likewise, the application should not accept the following inputs,

| input | pence (canonical) | description |
| | 0 | empty string |
| 1x | 0 | non-numeric character |
| £1x.0p | 0 | non-numeric character |
| £p | 0 | missing digits | 

bbc-coin-test's People

Contributors

saracen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.