Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a C++ program that finds the tax liability for taxpayers. The program should make use of functions to modularize the task. No global variables

Design a C++ program that finds the tax liability for taxpayers. The program should make use of functions to modularize the task. No global variables can be used. No arrays may be used. Here are the tax rules and rates:

Gross income is the total taxable income earned by the taxpayer.

Taxpayers may choose a filing status of single or married.

Taxpayers may claim dependents (including themselves).

Each dependent claimed provides the taxpayer with a $1200 exemption.

In addition to exemptions for dependents, each taxpayer may claim a standardized deduction or may itemize deductions. The standard deduction is $3000, therefore, itemized deductions must be greater than $3000 to benefit the taxpayer.

Exemptions for dependents and standard/itemized deductions are used to reduce gross income.

Taxpayers have taxes withheld from their earnings.

Taxable income is gross income less exemptions and deductions.

Total taxes due are determined by multiplying the appropriate tax rate by taxable income (if it is greater than 0). Taxpayers with a taxable income less than 0 have taxes payable of $0.

Taxes payable are total taxes due less taxes withheld. If taxes withheld exceed taxes payable then the taxpayer is due a refund of the difference between what is due and what was withheld.

Taxable Income Single Married
< $30,000 4% 2%
$30,000 and <$100,000 8% 6%
$100,000 and <$1,000,000 20% 18%
$1,000,000 35% 30%

INPUT The input for the program will be read from a file via Linux redirection. All data in the file must be processed. The format for the data will be as follows:

last name of taxpayer -- may be in any combination of upper and lowercase letters

filing status -- single or married -- may be in any combination of upper and lower case letters

# of dependents -- integer (will include all members of family)

first names of dependents - # of names will match # of dependents - may be in any combination of upper and lower case letters

gross income -- double

taxes withheld -- double

type of deduction -- standard or itemized -- may be any combination of upper or lower case

itemized deductions -- only present if type of deduction is itemized -- will consist of a series of double values separated by whitespace, 0.0 will signal the end of itemized amounts

No field will be missing (except when type of deduction is standard a list of amounts to deduct will not be provided, see sample input below). Each field will be separated by whitespace. PROCESSING The program must read the information for a taxpayer and use the information to determine how much is owed in taxes or due back to the taxpayer. When calculating taxes, your program should use the type of deduction (standard or itemized) that is most beneficial to the taxpayer. This means that if the input data indicates itemized, but the total itemized deductions are less than $3000, the program should automatically use the standard deduction for computing taxes and printing the summary report. The program should print a summary report for each taxpayer. There should be no prompts. OUTPUT (all output should be written to the screen)

Generate a tax summary report for each taxpayer record in the data file.

Each report should be separated by at least 1 blank line and should be formatted as shown in the sample output below.

FORMATTING REQUIREMENTS

All names and filing status should be displayed with the first letter capitalized and the remaining letters in lower case.

Separate the names of the family members with commas.

All monetary amounts should be displayed with 2 digits to the right of the decimal and should be right justified.

Display tax rate as an integer followed by % sign.

Assume that the maximum amount to be displayed will be less than $10,000,000.

Note that the gross income and taxes due (or refund due) amounts should be displayed with dollar signs.

If an amount is to be deducted then a minus sign (-) should precede the dollar amount.

If exemptions and deductions exceed gross income, taxable income should be set to 0.0 and displayed as 0.00, not a negative number.

The label for the last line of the report should read "Taxes due:" if the taxpayer owes 0 or more dollars and read "Refund due:" if the taxpayer is receiving money back.

ASSUMPTIONS

The input file will not be empty.

List of names of family members can all be displayed on one line.

The last line of the input file will be terminated by a linefeed.

NOTES:

If you use library functions, make sure you include the appropriate header files.

Do not implement arrays or fstream, as input will be taken through cin using Linux Redirection. There should be no prompts.

Sample input and output: [keys]$ more data4four jones married 3 alan mary joe 67000. 1200. standarD mitChell SinGle 1 MICHael 10000. 1000. Itemized 8500. 750. 0. smith maRRied 6 anne barry CLAY dOUGLAS ediTH FRANCIS 35000. 7500. itemIZED 35.75 500.0 1050.35 678. 950. 0. ADAMS singLE 2 maRy Sam 200000. 35000. iTemIZed 500. 600. 200. 75. 0. [keys]$ g++ assign.cpp [keys]$ ./a.out < data4four Tax summary for Jones family Filing status: Married Dependents: Alan, Mary, Joe Gross income: $ 67000.00 Exemptions: - 3600.00 Standard deduction: - 3000.00 Taxable income: 60400.00 Tax rate: 6% Taxes payable: 3624.00 Taxes withheld: - 1200.00 Taxes due: $ 2424.00 Tax summary for Mitchell family Filing status: Single Dependents: Michael Gross income: $ 10000.00 Exemptions: - 1200.00 Itemized deduction: - 9250.00 Taxable income: 0.00 Tax rate: 4% Taxes payable: 0.00 Taxes withheld: - 1000.00 Refund due: $ 1000.00 Tax summary for Smith family Filing status: Married Dependents: Anne, Barry, Clay, Douglas, Edith, Francis Gross income: $ 35000.00 Exemptions: - 7200.00 Itemized deduction: - 3214.10 Taxable income: 24585.90 Tax rate: 2% Taxes payable: 491.72 Taxes withheld: - 7500.00 Refund due: $ 7008.28 Tax summary for Adams family Filing status: Single Dependents: Mary, Sam Gross income: $ 200000.00 Exemptions: - 2400.00 Standard deduction: - 3000.00 Taxable income: 194600.00 Tax rate: 20% Taxes payable: 38920.00 Taxes withheld: - 35000.00 Taxes due: $ 3920.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

Which methods are most used in practice?pg.12

Answered: 1 week ago