Created
February 1, 2012 03:46
-
-
Save bwilkins/1714960 to your computer and use it in GitHub Desktop.
My quick hack-up to calculate NZ PAYE tax on individual yearly gross income. Added whitespace for readability (originally wrote in jconsole, just to discover it can't do multi-line function defs)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tax(total) { | |
var accum = 0 | |
for (var dollar=0; dollar < total; dollar++) { | |
if (dollar < 14000) | |
accum+=0.1254 | |
else if (dollar < 48000) | |
accum+=0.1954 | |
else if (dollar < 70000) | |
accum+=0.3204 | |
else | |
accum+=0.3504 | |
} | |
return accum | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment