Skip to content

Instantly share code, notes, and snippets.

@thinkier
Created June 10, 2022 05:45
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 thinkier/3abe9eeecfe8c4665c6c5fef7abfbf86 to your computer and use it in GitHub Desktop.
Save thinkier/3abe9eeecfe8c4665c6c5fef7abfbf86 to your computer and use it in GitHub Desktop.
Australian Marginal Income Tax calculator (dumps to csv)
const brackets: Array<[number, number]> = [
[ 0, 0],
[ 18200, 19],
[ 45000, 32.5],
[ 120000, 37],
[ 180000, 45]
];
console.log("Income", "Tax");
for(let amt = 0; amt <= 1000000; amt++) {
let taxed = 0;
let aft = 0;
for(let bracket of brackets) {
let [min, tax] = bracket;
if (amt < min) break;
aft += (amt - min) * (tax - taxed) / 1e2;
taxed = tax;
}
console.log(`${amt},${aft.toFixed(2)}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment