Question: Make sure to verify your code matches the specification below word by word. If your outputs don't match, re - read this carefully, word by
Make sure to verify your code matches the specification below word by word. If your outputs don't match, reread this carefully, word by word.
Some degree of redundancy is acceptable in the design of the if statements in this problem.
A Tax computation rule is described as follows.
Three inputs come in: income, married or not, number of exemptions claimed.
Any individual can claim exemptions, up to a maximum of or
For singles each exemption is worth dollars.
For married people, each exemption is worth dollars.
So a married person claiming exemptions gets $ total exemption.
The total exemption amount is subtracted from the income to compute the taxable income.
The tax rate is determined based on the taxable income, using the following rule:
Single: for amounts above Rate is
otherwise
Married: for amounts above Rate is
otherwise
The tax is computed using taxable income and tax rate.
You can assume not married is the same as single You can collect this input married or not in any way you prefer. You can assume all three inputs will be supplied by the user as directed by the program.
Implement the computations above, and display tax.
Comments:
Assume the user will enter or as expected for the number of exemptions. You do not need to write code to verify this range of values.
The emphasis in this problem is on: accuracy, and welldesigned, and efficient if statements. For accuracy, you are given sample data below, and if your outputs do not match, revisit the specifications, and read them closely; review your if statements to see if there are redundant conditions, or computations that repeat under every branch etc; review prior material on if statements.
Note that in this problem the married or not affects two different stages of computations; and it is okay to write the if for married or not twice when dealing with that. That is not the only way to construct the if statements in this problem, but it may yield a clean and simple design.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
