kevkul

netincome.js

Jan 17th, 2021
775
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function NETINCOME(salary, inf, t) {
  2.   var ret=0;
  3.   var workSal = salary;
  4.   var proBracketPer = [0.0, 0.16, 0.2, 0.24, 0.2575];
  5.   var fedBracketPer = [0.0, 0.15, 0.22, 0.26, 0.29];
  6.   var proBrackets = [11327, 41935*Math.pow(inf, t), 83865*Math.pow(inf, t), 102040*Math.pow(inf, t), 999999];
  7.   var fedBrackets = [11327, 44701*Math.pow(inf, t), 89401*Math.pow(inf, t), 138586*Math.pow(inf, t), 999999];
  8.  
  9.  
  10.   for(i=3; i>=0; i--){
  11.     if(workSal>proBrackets[i] && workSal<proBrackets[i+1]){
  12.       ret = (ret+(workSal-proBrackets[i])*proBracketPer[i+1]);
  13.       workSal=proBrackets[i]-1;
  14.     }
  15.   }
  16.  
  17.   workSal = salary;
  18.   for(i=3; i>=0; i--){
  19.     if(workSal>fedBrackets[i] && workSal<fedBrackets[i+1]){
  20.       ret = (ret+(workSal-fedBrackets[i])*fedBracketPer[i+1]);
  21.       workSal=fedBrackets[i]-1;
  22.     }
  23.   }
  24.  
  25.  
  26.   return salary-ret;
  27. }
RAW Paste Data