Question
Assignment 3-3: Develop the Income Tax Calculator In this a ssignment , youll use nested if statements and arithmetic expressions to calculate the federal income
Assignment
3-3:
Develop the Income Tax Calculator
In this a
ssignment
, youll use nested if statements and arithmetic expressions to
calculate the federal income tax that is owed for a taxable income amount.
This is the 2017 table for the federal income tax on individuals that you should use
for calculating the tax:
Taxable income
Income tax
Over...
But not over...
Of excess over...
$0
$9,275
$0 plus 10%
$0
$9,275
$37,650
$927.50 plus 15%
$9,275
$37,650
$91,150
$5,183.75 plus 25%
$37,650
$91,150
$190,150
$18,558.75 plus 28%
$91,150
$190,150
$413,350
$46,278.75 plus 33%
$190,150
$413,350
$415,050
$119,934.75 plus 35%
$413,350
$415,050
$120,529.75 plus 39.6%
$415,050
1.
Open the HTML and JavaScript files in this
folder:
JavaScriptProgramming-Assignment
3\income_tax\
Note that the JavaScript file has some starting JavaScript code for this
application, including the $ function and an onload event handler that attaches a
function named pr
ocessEntry() to the click event of the Calculate button and
moves the focus to the first text box.
2.
Code the processEntry() function. It should get the users entry and make sure its a
valid number greater than zero. If it isnt, it should display an error message. If it is
valid, it should pass the value to a function named calculateTax(), which should
return the tax amount. That amount should then be displayed in the second text box.
The focus should be moved to the first text box whether or not the entry is
valid.
3.
Code the calculateTax() function, but to start, just write the code for calculating the
tax for any amount within the first two brackets in the table above. The users entry
should be converted to an integer, and the tax should be rounded to two decimal
places. To test this, use income values of 9275 and 37650, which should display
taxable am
ounts of 927 and
5183.50.
4.
Add the JavaScript code for the next tax bracket. Then, if you have the time,
add the
JavaScript code for the remaining tax
brackets
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started