Coding Challenge # 3: Tax Calculator

The objective of this exercise is to practice understanding a statement and using the tools that we know to create solutions to concrete problems.


We want to create a form to calculate the tax we will pay for the current year.
The objective of this exercise is to test your ability to interpret an instruction and translate an explanation into an algorithm.

The government has created an explanatory sheet to understand the calculation of the tax rate but this calculation is relatively complex and we want to create a simplified interface to calculate things. The tax calculation system is detailed on the government website by following this address:

  1. To start, we want to create a form in which we will enter the amount that we intend to declare (net value) and the system must automatically calculate the tax that we will have to pay as well as the amount that we will have left. (We will take the case of a single person to begin with).
  2. We will add a checkbox to specify if we are in a relationship and another field will allow us to specify the number of children. Based on these new data, the system will adapt the rate.
  3. We want to have a detail of the amount we pay per installment. The system will therefore display a table to specify the amount to be paid for each installment.
  4. Finally we will take the problem in reverse order and allow the user to enter the desired amount (after tax) and the system will calculate the net income to have to obtain this amount after tax.

Your solutions

The solutions proposed to this challenge are really successful and I thank all the participants again. Here are some remarks on the different versions that I could read:

  • The site gives examples of tax calculations, so it is interesting to use these examples as a working basis and to set up TDD.
  • The calculations being a little complex it is important to separate the logical part and the interface part. Calculations placed in the middle of the composting code or manipulation of the DOM should be avoided.

Live attempt






Please enter your comment!
Please enter your name here