Skip to content

Instantly share code, notes, and snippets.

@MrAwesomeness
Created April 8, 2015 20:17
Show Gist options
  • Save MrAwesomeness/1ed6e8afe6b971008d67 to your computer and use it in GitHub Desktop.
Save MrAwesomeness/1ed6e8afe6b971008d67 to your computer and use it in GitHub Desktop.
This is a quick and dirty Tax Calculator for 2014 for Utah Residents. It calculates your annual income after taxes, social security and medicare have been taken out. The code is written so it can be run at http://repl.it/
/*This is a Tax Calculator based off of 2014 information for married filing jointly
It assumes that you are filing a standard deduction and you made less than $152,525*/
var STANDARD_DEDUCTION = 12400;
var DEPENDENT_VALUE = 3950;
var tax1 = (18150 * 0.1);
var tax2 = ((73800 - 18150) * 0.15);
var tax3 = ((148850 - 73800) * 0.25);
var ficaMax = 117000;
var medicareRate = 0.145;
console.log("What was your income for the year?");
var income = prompt();
console.log("Including yourself, how many dependants are you claiming?");
var dependents = prompt();
if(income > ficaMax){
var Fica = ficaMax * 0.062;
}
else{
var Fica = Math.round(income * 0.062);
}
console.log('\n' + "Fica/Social Security is: " + Fica);
var medicare = Math.round(income * medicareRate);
console.log("Medicare is: " + medicare);
if(income && dependents > 0){
var taxable = income - ((dependents*DEPENDENT_VALUE)+(STANDARD_DEDUCTION));
console.log("Your taxable income is " +taxable);
}
if((taxable > 148851) && (taxable<= 152525)){
var tax = ((taxable - 148851) * 0.28) +(tax1+tax2+tax3);
}
else if(taxable > 73801 && taxable<= 148850){
var tax = ((taxable - 73800) * 0.25) + (tax1+tax2);
}
else if(taxable > 18151 && taxable<= 73800){
var tax = ((taxable - 18151) * 0.15) + (tax1);
}
else if(taxable > 0 && taxable < 18150 ){
var tax = taxable *0.1;
}
console.log ("Federal Taxes are: " + Math.round(tax));
var STATE = 0.05;
var STATE_STANDARD_DEDUCTION = 27180;
var utahTax = (income*STATE);
var stateDeduction = STANDARD_DEDUCTION + (dependents*2963);
var initialCredit = stateDeduction * 0.06;
if(income > STATE_STANDARD_DEDUCTION){
var phaseOut = ((income - STATE_STANDARD_DEDUCTION) * 0.013);
}
else {
var phaseOut =0;
}
var stateCredit = (initialCredit - phaseOut);
var finalTax = (utahTax-stateCredit);
var allTaxes = Math.round(Fica+medicare+tax+finalTax);
console.log("Utah State taxes are: " + Math.round(finalTax) + '\n');
console.log("Your Net Income is " + (income-allTaxes));
console.log("All taxes taken out are " + allTaxes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment