Skip to content

CommandShiftHQ/calculate-bill-kata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculate Bill kata

Create a function that takes the price of the bill, the VAT rate and the tip amount 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.js, 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 expecting? - 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
    
  1. Write the code to pass the first test. Keep a terminal window open and run your test by doing npm test or npm t

  2. Things to nose at:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published