akosiraff

Download Taxes JavaScript Answer

Jan 29th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1.  
  2. Download: https://solutionzip.com/downloads/taxes-javascript/
  3. In a separate JS file, write a function to compute the amount of taxes that should be withheld from a paycheck based on the gross pay. The function should receive one parameter, the gross pay. Withholdings are calculated based on the following table:
  4. Category Percentage
  5. Federal taxes 31%
  6. State taxes 8%
  7. Local taxes 2%
  8. All local taxes are deductable from the gross amount used to calculate state taxes. Likewise all state and local taxes are deductable from the gross amount used to calculate federal taxes. The function should accept one parameter, the gross pay, and return one result, the total withholdings based on the above table and rules. Again, the function should not do any output, but should just return a number. Here is an example:
  9. Input: 1000.00, return 377.90. Why not just 41% of 1000 = 410? 2% of $1000.00 is $20.00. Now subtract the $20.00 out of the gross, leaving $980.00 as the base for calculating state taxes. 8% of $980.00 is $78.40. Subtract $78.40 from the $980.00 to get $901.60, the base for calculating federal taxes. 31% of $901.60 is $279.50 (rounded to the nearest penny). When $20.00, $78.40, and $279.50 are added together, the result is $377.90, which is the answer that should be returned from the function. Note that these numbers are rounded to the nearest penny, which is possible with either the .toFixed() method of a number or by using Math.round().
  10.  
  11. Download: https://solutionzip.com/downloads/taxes-javascript/
Add Comment
Please, Sign In to add comment