Skip to content

Instantly share code, notes, and snippets.

@rumblestrut
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save rumblestrut/83b3d05a22ac72eba73c to your computer and use it in GitHub Desktop.

Select an option

Save rumblestrut/83b3d05a22ac72eba73c to your computer and use it in GitHub Desktop.
const OLD_TAX_RATE = 0.061;
const NEW_TAX_RATE = 0.065;
function calculateOldPurchase(amt) {
amt = amt + (amt * OLD_TAX_RATE);
return amt;
}
function calculateNewPurchase(amt) {
amt = amt + (amt * NEW_TAX_RATE);
return amt;
}
price = 150.00;
old_total = calculateOldPurchase(price);
new_total = calculateNewPurchase(price);
console.log("Based on a $150 purchase, your previous total under the state sales tax rate of 6.1 percent would be " + "$" + old_total.toFixed(2) + ", but now costs you " + "$" + new_total.toFixed(2) + " at 6.5 percent.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment