Last active
August 29, 2015 14:13
-
-
Save andrewatts85/41840e5da4e00080eb63 to your computer and use it in GitHub Desktop.
Calculate weekly and monthly cashflow after taxes and deductions.
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
//http://repl.it/8R0/3 | |
//Calculate weekly and monthly cashflow after taxes and deductions. | |
var netPay = function(wage, hours) { | |
var gross = wage * hours; | |
var monthlyGross = gross * 4; | |
var annualGross = gross * 52; | |
var savings = gross * 0.1; | |
var debt = gross * 0.2; | |
var taxes = gross * 0.2; | |
var childSupport = 92; | |
var rent = 37.5; | |
var totalDeductions = savings + debt + taxes + childSupport + rent; | |
var weeklyCashflow = gross - totalDeductions; | |
var monthlyCashflow = weeklyCashflow * 4; | |
var monthlySavings = savings * 4; | |
var monthlyDebtRelief = debt * 4; | |
var annualCashflow = weeklyCashflow * 52; | |
var annualSavings = savings * 52; | |
var annualDebtRelief = debt * 52; | |
var afterTaxes = gross - taxes; | |
console.log("Gross: " + gross); | |
console.log("Monthly Gross: " + monthlyGross); | |
console.log("Annual Gross: " + annualGross + "\n"); | |
console.log("Savings: " + savings); | |
console.log("Debt: " + debt); | |
console.log("Taxes: " + taxes); | |
console.log("Child Support: " + childSupport); | |
console.log("Rent: " + rent + "\n"); | |
console.log("Total Deductions: " + Math.round(totalDeductions) + "\n"); | |
console.log("Weekly Cashflow: " + Math.round(weeklyCashflow) + "\n"); | |
console.log("Monthly Cashflow: " + Math.round(monthlyCashflow)); | |
console.log("Monthly Savings: " + Math.round(monthlySavings)); | |
console.log("Monthly Debt Relief: " + Math.round(monthlyDebtRelief) + "\n"); | |
console.log("Annual Cashflow: " + Math.round(annualCashflow)); | |
console.log("Annual Savings: " + Math.round(annualSavings)); | |
console.log("Annual Debt Relief: " + Math.round(annualDebtRelief) + "\n"); | |
return Math.round(afterTaxes - childSupport); | |
}; | |
netPay(11.65, 30); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment