Incometax.md

March 19, 2018 ยท View on GitHub

#Kata: Income Tax Calculator

Introduction

The United States Income Tax is a Progressive Tax, broken into brackets by the amount of yearly household income.

Rules

The 2013 tax owed for a person filing as Single is:

Amount EarnedPercentage Owed
under $829510%
under $36,25015%
under $87,85025%
under $8785028%
under $183,25030%
under $398,35033%
under $400,00035%
over $400,00139.6%

The tax is progressive, in that only the portion of income that falls into a certain bracket is only taxed at that bracket's rate.

For example, a person making $10,000 per year would be taxed at 10% for every dollar in the lowest bracket ($829.50), the remaining $1,705 taxed at 15% ($255.75), for a total tax of $1,085.25.

Tax is only owed in whole dollar amounts. The final result should round to the nearest whole dollar. (Round down for 0.01-0.49, and up 0.50 to 0.99).

Test Cases

  1. No_Income_Returns_0()
  2. Negative_Income_Returns_0()
  3. Income_Of_10000_Returns_1085()
  4. Income_Of_20000_Returns_2585()
  5. Income_Of_450000_Returns_123149()

Extra Credit

Extra Credit Test Cases