Coder Social home page Coder Social logo

calculate-bill-kata's Introduction

Calculate Bill kata

Create a function that takes the price of the bill, the VAT rate and the tip rate and returns the total amount the customer needs to pay, formatted as a currency string.

Step by step

  1. Fork this repo to your account

  2. Clone down the repo:

        git clone <YOUR_BRANCH_URL>
  3. Open the repo in you terminal:

        cd calculate-bill-kata
  4. Install the project:

    npm i # shorter version of npm install
  5. Run the tests:

    npm test # they will fail to run. We haven't written any code yet.
  6. Open VSCode by typing code . or by opening it mannually and navigating to the kata folder/directory

  7. In index.html, declare a function called calculateBill. Leave the function body empty for now. Export your function at the bottom of the file with:

    module.exports = calculateBill;
  8. Commit and push your work to github

  9. Look at test/index.test.js, what is the first test expexting? - can you write it in pseudocode? Which steps would it take? Maybe something like:

    // create a function // this function will have to have 3 arguments - amount, vat and tip? // this function will have to return a string with a currency sign

  10. Write the code to pass the first test. Keep a terminal window open and run your test by doing npm test or npm t

  11. Things to nose at:

calculate-bill-kata's People

Contributors

ian-antking 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.