CISP 1610 – Programming in C++ Final Examination (Tax Calculation)

CISP 1610 – Programming in C++

Final Examination (Tax Calculation)

You are to modify the midterm examination to take advantages of many of the features that we have encountered in chapters 8 through 12.  The primary objective of the solution remains to compute federal personal income taxes.  The solution can have NO global variables.  The tax liability 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%.

The six tax rates are to be stored in a one-dimensional array with data type float.  The four filing status descriptions are to be stored in a one-dimensional array of data type string..

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. taxRate[6] float 6 tax rates with amounts specified in the above table. filingStatus[4] string 4 filing status descriptions as shown in the above table.

Your program should be modular and contain at least 4 user defined functions beyond the main() function.  You are to follow these specifications as closely as possible.  You should have functions that do the following:

 Functions Description and specifications main() main() should be concise and drive the execution of the solution.  The primary loop should be a while loop that repeats the steps necessary to display the results until the user enters a status code of 9 that will terminate the job. getStatusCode This function is to input the filing status code.  This is to be a return by value function.  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.. getTaxIncome This function is to input taxable income and is a return by value function.  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. calcTaxAmt This function is to calculate the taxAmt as determined by statusCode and taxableIncome.  This is a return by value function. displayResults The role of this function is to display the program’s results.  You are to display the filing status description, the taxable income, and the tax amount.  Your report should use proper formatting.  This is a void function.

Hint:  As you can see the tax rates are the same for each of the filing statuses.  The primary differences in all the status groups are the range amounts for the applicable tax rates. The following is an example of calculations and resulting output with a taxable income of \$70,000 and a married filing jointly filing status.  (There is also an Excel spreadsheet supplied that provides details of calculations for each appropriate tax bracket.)  You may experience minor differences between some examples and your program due to computational rounding and truncation.

Taxable Income:  \$70000, Filing status of Married Filing Jointly

Display of above

Filing status:  Married Filing Jointly

Taxable income:    \$70000.00

Tax amount:          \$10615.00

×