You are to write a C++ program to compute federal personal income taxes. The tax owned depends on how much money one makes as well as their filing status. For our purposes we will use four filing statuses. These are (1)single filers, (2)married filing jointly, (3)married filing separately, and (4)head of household.
Tax Rate
|
Single Filers
|
Married Filing Jointly
|
Married Filing Separately
|
Head of Household
|
10%
|
Up to $7,550
|
Up to $15,100
|
Up to $7,550
|
Up to $10,750
|
15%
|
$7,551-$30,650
|
$15,101-$61,300
|
$7,551-$30,650
|
$10,751-$41,050
|
25%
|
$30,651-$74,200
|
$61,301-$123,700
|
$30,651-$61,850
|
$41,051-$106,000
|
28%
|
$74,201-$154,800
|
$123,701-$188,450
|
$61,851-$94,225
|
$106,001-$171,650
|
33%
|
$154,801-$336,550
|
$188,451-$336,550
|
$94,226-$168,275
|
$171,651-$336,550
|
35%
|
$336,551 or more
|
$336,551 or more
|
$168,276 or more
|
$336,551 or more
|
For each filing status there are six tax rates. Each rate is applied to a given amount of the taxable income. For example, for a taxable income of $450,000 for a single filer, $7,550 is taxed at 10%, ($30,650-$7,550) at 15%, ($74,200-$30,650) at 25%, ($154,800-$74,200) at 28%, ($336,550-$154,800) at 33%, and ($450,000-336,550) at 35%.
Variables
Name
|
Type
|
Description and edit specifications
|
statusCode
|
Int
|
Status code must be from 1 to 4. 1=single, 2=married filing jointly, 3=married filing separately, 4= head of household, 9 = end processing.
|
taxableIncome
|
Float
|
Taxable income is entered by the user from the keyboard. The amount must be numeric and not less than $500.
|
taxAmt
|
Float
|
taxAmt is a calculated field and is determined from the supplied tax table as applied to the taxableIncome.
|
Your program should be modular, that is small blocks of code. (Later in the semester when we encounter functions, you will see how handy modular development can be.) You are to follow these specifications as closely as possible. You should have code blocks that do the following:
- Input status code. You should use a do/while loop to control the input logic. You are to keep the user in the loop until the input is correct. You are to ensure that the status codes are as specified above.
- Input taxable income. As in step 1, you are to use a do/while loop for this logic. You are to keep the user in the loop until the input is valid.
- Calculate the tax owned as a result of status code and taxable income. You are to use a switch statement for the appropriate logic for each status code. You should manually calculate several cases to ensure your program is performing correctly.
- Display the results of the calculation step. You are to output the status code, the string description of the status code, the taxable income, and the total tax amount. You are to use appropriate formatting of the output.
- You main loop should be a while loop that repeat steps 1 through 4 until the user enters a status code of 9 that will terminate the job.