Programming Assignment 2 – Income Tax In this assignment you will practice: reading input from the keyboard writing expr
Posted: Mon Jun 06, 2022 5:06 pm
Programming Assignment 2 – Income Tax
In this assignment you will practice:
reading input from the keyboard
writing expressions involving integers and real numbers
translate conditional formulas into code
use formatted printing for output
Description
The program should ask the user to input some of the information
that normally appears on a tax form, and then calculate a tax bill
according to the formulas described below. WARNING: the tax
computation shown here is greatly simplified and should not be used
for calculation of real taxes!
Instructions
For this assignment, you must follow directions exactly. Create
a class named Lab02 with a main method, and put all of the
following code into the main method:
Print the prompt shown below that asks the user for the
number of exemptions. Read in the exemptions as an integer.
Print the prompt that asks with decimal points.
Print the prompt that asks
Print the prompt that asks
Print the prompt that asks
Perform the calculation of
Perform the calculation of
Perform the calculation of
the user for their gross salary as a dollar value, which can be
entered
the user for their interest income as a dollar value.
the user for their capital gains income as a dollar value.
the user for the amount of charitable contributions as a dollar
value.
total income, as shown in the Formula section.
the adjusted income, as shown in the Formula section.
the total tax, as shown in the Formula section. This will
require if
statements.Itisrecommendedthatusealsouseelse
ifandelsestatements.
Print out the total income, adjusted gross income, and total
tax with a dollar sign and exactly
two decimal places.
The example below shows five lines of user input followed by three
lines of program output:
Number of Exemptions: 3
Gross Salary: 67234.45
Interest Income: 2145.32
Capital Gains: 523.01
Charitable Contributions: 872.45
Total Income: $69902.78 Adjusted Income: $64530.33 Total Tax:
$11508.49
Formulas
Total Income = Gross Salary + Interest Income + Capital
Gains
Adjusted Income = Total Income - (Number of Exemptions *
1500.00) - Charitable Contributions
Total Tax computation:
0% paid on Adjusted Income less than or equal to $10,000
15% paid on Adjusted Income above $10,000 and less than or equal to
$32,000 23% paid on Adjusted Income above $32,000 and less than or
equal to $50,000 28% paid of Adjusted Income above $50,000
For example, if Adjusted Income is $64,530.33 then we compute
the Total Tax as follows: 15% * ($32,000.00-$10,000.00) =
$3300.00
23% * ($50,000.00-$32,000.00) = $4140.00
28% * ($64,530.33-$50,000.00) = $4068.49
Adding all that up we get a Total Tax of $11,508.49, much higher
than current tax rates!
Specifications
Your program must meet the following specifications:
The name of the source code file must be Lab02.java
Include comments at the top with your name, short description of
this program, e-Name (e-
mail), date and course title.
The output format must exactly match the example shown above,
including blank line, white
space and capitalization. I will make one exception, which is
that I will allow a gap between the
dollar sign and the number, but there is a way to make it flush
with the number!
Store the result of calculations in variables. Don’t make
calculations in print statements.
The output should report exactly 2 decimal places.
Your program should be accurate to within $0.01
I will test your program as follows (your submitted program name
is Lab02.java)
In this assignment you will practice:
reading input from the keyboard
writing expressions involving integers and real numbers
translate conditional formulas into code
use formatted printing for output
Description
The program should ask the user to input some of the information
that normally appears on a tax form, and then calculate a tax bill
according to the formulas described below. WARNING: the tax
computation shown here is greatly simplified and should not be used
for calculation of real taxes!
Instructions
For this assignment, you must follow directions exactly. Create
a class named Lab02 with a main method, and put all of the
following code into the main method:
Print the prompt shown below that asks the user for the
number of exemptions. Read in the exemptions as an integer.
Print the prompt that asks with decimal points.
Print the prompt that asks
Print the prompt that asks
Print the prompt that asks
Perform the calculation of
Perform the calculation of
Perform the calculation of
the user for their gross salary as a dollar value, which can be
entered
the user for their interest income as a dollar value.
the user for their capital gains income as a dollar value.
the user for the amount of charitable contributions as a dollar
value.
total income, as shown in the Formula section.
the adjusted income, as shown in the Formula section.
the total tax, as shown in the Formula section. This will
require if
statements.Itisrecommendedthatusealsouseelse
ifandelsestatements.
Print out the total income, adjusted gross income, and total
tax with a dollar sign and exactly
two decimal places.
The example below shows five lines of user input followed by three
lines of program output:
Number of Exemptions: 3
Gross Salary: 67234.45
Interest Income: 2145.32
Capital Gains: 523.01
Charitable Contributions: 872.45
Total Income: $69902.78 Adjusted Income: $64530.33 Total Tax:
$11508.49
Formulas
Total Income = Gross Salary + Interest Income + Capital
Gains
Adjusted Income = Total Income - (Number of Exemptions *
1500.00) - Charitable Contributions
Total Tax computation:
0% paid on Adjusted Income less than or equal to $10,000
15% paid on Adjusted Income above $10,000 and less than or equal to
$32,000 23% paid on Adjusted Income above $32,000 and less than or
equal to $50,000 28% paid of Adjusted Income above $50,000
For example, if Adjusted Income is $64,530.33 then we compute
the Total Tax as follows: 15% * ($32,000.00-$10,000.00) =
$3300.00
23% * ($50,000.00-$32,000.00) = $4140.00
28% * ($64,530.33-$50,000.00) = $4068.49
Adding all that up we get a Total Tax of $11,508.49, much higher
than current tax rates!
Specifications
Your program must meet the following specifications:
The name of the source code file must be Lab02.java
Include comments at the top with your name, short description of
this program, e-Name (e-
mail), date and course title.
The output format must exactly match the example shown above,
including blank line, white
space and capitalization. I will make one exception, which is
that I will allow a gap between the
dollar sign and the number, but there is a way to make it flush
with the number!
Store the result of calculations in variables. Don’t make
calculations in print statements.
The output should report exactly 2 decimal places.
Your program should be accurate to within $0.01
I will test your program as follows (your submitted program name
is Lab02.java)