Skip to content

Instantly share code, notes, and snippets.

@bwilkins
Created February 1, 2012 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwilkins/1714960 to your computer and use it in GitHub Desktop.
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)
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