Question

I HAVE TO SOLVE A C++ PROGRAM, THIS ARE THE INSTRUCTIONS: Write a program that can...

I HAVE TO SOLVE A C++ PROGRAM, THIS ARE THE INSTRUCTIONS:

Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For single people, the standard exemption is $4,000; for married people, the standard exemption is $7,000. A person can also put up to 6% of his or her gross income in a pension plan. The tax rates are as follows: If the taxable income is:

  • Between $0 and $15,000, the tax rate is 15%.
  • Between $15,001 and $40,000, the tax is $2,250 plus 25% of the taxable income over $15,000.
  • Over $40,000, the tax is $8,460 plus 35% of the taxable income over $40,000. Prompt the user to enter the following information:
  • Marital status
  • If the marital status is “married,” ask for the number of children under the age of 14
  • Gross salary (If the marital status is “married” and both spouses have income, enter the combined salary.)
  • Percentage of gross income contributed to a pension fund Your program must consist of at least the following functions:
    • Function getData: This function asks the user to enter the relevant data.
    • Function taxAmount: This function computes and returns the tax owed.

To calculate the taxable income, subtract the sum of the standard exemption, the amount contributed to a pension plan, and the personal exemption, which is $1,500 per person. (Note that if a married couple has two children under the age of 14, then the personal exemption is $1,500 ∗ 4 = $6,000.)

Since your program handles currency, make sure to use a data type that can store decimals with a decimal precision of 2.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Code:

2 3 4 6 7 main.cpp 1 //Include necessary headers #include <iostream> #include<string> using namespace std; 5 //Declaration of30 31 32 33 cin>>nochild; cout<<\nIs your spouse have income (Yes or No):; cin>>temp; if(temp==Yes) 34 { 35 36 cout<<\nE58 { 59 60 61 62 63 stdEx=7000; txInc=grossSalary-(stdEx+pensionPlan+3000+(1500*noChild)); } if(txInc>0 && txInc<=15000) { ta

Output:

} ./main Enter your marital status (Single or Married) :Married Enter the No.of children under age 14:2 Is your spouse have i

Copyable Code:

//Include necessary headers

#include <iostream>

#include<string>

using namespace std;

//Declaration of functions and variables

void getData();

double taxAmount();

string maritalStatus;

double grossSalary=0,pensionPlan;

int noChild;

//Main

int main() {

getData();

double tax;

tax=taxAmount();

cout<<"\nYour Tax Amount is:"<<tax;

}

//Function to get the data

void getData()

{

double spouseIncome=0,percentage;

string temp;

//Prompt and get from user

cout<<"\nEnter your marital status(Single or Married):";

cin>>maritalStatus;

if(maritalStatus=="Married")

{

cout<<"\nEnter the No.of children under age 14:";

cin>>noChild;

cout<<"\nIs your spouse have income(Yes or No):";

cin>>temp;

if(temp=="Yes")

{

cout<<"\nEnter your spouse Income:";

cin>>spouseIncome;

}

}

cout<<"\nEnter your Basic Gross Salary:";

cin>>grossSalary;

grossSalary=grossSalary+spouseIncome;

cout<<"\nEnter your percentage of fund:";

cin>>percentage;

pensionPlan=grossSalary*(percentage/100);

}

//Function to calculate the tax amount

double taxAmount()

{

double taxRate,taxRate1,stdEx,txInc;

if(maritalStatus=="Single")

{

stdEx=40000;

txInc=grossSalary-(stdEx+pensionPlan+1500);

}

else

{

stdEx=7000;

txInc=grossSalary-(stdEx+pensionPlan+3000+(1500*noChild));

}

if(txInc>0 && txInc<=15000){

taxRate=0.15;

}

else if(txInc>15000 && txInc<=40000)

{

taxRate=2250;

taxRate1=(grossSalary-15000)*0.25;

taxRate=taxRate+taxRate1;

}

else

{

taxRate=8460;

taxRate1=(taxRate-40000)*0.35;

}

return taxRate;

}

Add a comment
Know the answer?
Add Answer to:
I HAVE TO SOLVE A C++ PROGRAM, THIS ARE THE INSTRUCTIONS: Write a program that can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Language C++ Write a program that can be used to calculate the federal tax. The tax...

    Language C++ Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For single people, the standard exemption is $4,000; for married people, the standard exemption is $7,000. A person can also put up to 6% of his or her gross income in a pension plan. The tax rates are as follows: If the taxable income is: Between $0 and $15,000, the tax rate is 15%. Between $15,001 and $40,000, the tax...

  • Please write in MATLAB code Write a program that can calculate the amount of federal tax...

    Please write in MATLAB code Write a program that can calculate the amount of federal tax a person owes for the upcoming year. After calculating the amount of tax owed, you should report to the user their filing status (single/joint), which tax rate they fell under, as well as the tax owed. Example: “As a single filer you fell under 12% tax bracket and you owe $3500.” Disclaimer: This example is simplified and is not intended to be an accurate...

  • 2. Harriet and Harry are married and have a total gross income of $65,000. Their allowable...

    2. Harriet and Harry are married and have a total gross income of $65,000. Their allowable deductions or adjusted gross income total $1,500, and they have $4,400 of allowable itemized deductions What are Harriet and Harry's taxable income and income tax liability? Table 1. Tax Brackets and Rates, 2019 Rate For Unmarried Individuals, Taxable Income Over For Married Individuals Filing Joint Returns, Taxable income Over For Heads of Households, Taxable Income Over 10% Se $0 12% $9,700 $19,400 $13,850 $78,950...

  • Uppose an unmarried individual without children has $40,000 in labor earnings. She has no other i...

    uppose an unmarried individual without children has $40,000 in labor earnings. She has no other income. Use the standard deduction and assume that aside from the Child Tax Credit and the EITC, no other tax credits exist. Use the tax tables from the handout to answer the following: a. How much is the employee portion of FICA that was withheld from the person's paychecks? b. What is the governments total tax revenue from payroll taxes from this person? c. What...

  • (python only) Write a program that asks the user for their filing status (single or married)...

    (python only) Write a program that asks the user for their filing status (single or married) and their taxable income. Then, using the below table, compute the tax owed and display the filing status, taxable income, and tax owed. If the filing status is single and the taxable income is overbut not over   the tax is of the amount over$0$9,52510%0$9,526$38,700$952.50 + 12%$9,525$38,701$82,500$4,453.50 +22% $38,700 $82,501unlimited$14,089.50 +24% $82,500 If the filing status is married filing jointly and the taxable income is overbut...

  • Sharon and Tray are married, have two dependent children, and file a joint return in 2018....

    Sharon and Tray are married, have two dependent children, and file a joint return in 2018. If they have adjusted gross income (AGI) of $80,000 and itemized deductions of $8,500, what is their taxable income for 2018? (Click the icon to view the standard deduction amounts.) (If an input field is not used, leave the input field(s) empty. Do not select a label or enter a zero.) Adjusted gross income Minus: Standard deduction 80,000 (24,000) 56,000 Taxable income STANDARD DEDUCTION...

  • Linette, a single taxpayer, had the tollowing income and deductions tor the tax year 2018: C...

    Linette, a single taxpayer, had the tollowing income and deductions tor the tax year 2018: C ck the icon to view the income and deductions. Click the icon to v ew the standard deduction amounts 을 (Cick the con to ew the 2018 tax rate schedule or he Single ng status. Read the requirements Requirement a. Compute Linette's taxable income and federal tax liability for 2018. First calculate the gross income, then calculate taxable income and the federal tax liability....

  • For 2016, the personal exemption amount is $4,050. The 2016 standard deduction is $6,300 for unmarried...

    For 2016, the personal exemption amount is $4,050. The 2016 standard deduction is $6,300 for unmarried taxpayers or married taxpayers filing separately, $12,600 for married taxpayers filing jointly, and $9,300 for taxpayers filing as head of household. Calculating Sarah and Helen's Taxable Income Sarah and Helen are a married couple filing jointly. Calculate Sarah and Helen's 2016 taxable income by filling in the worksheet. Enter adjustments, deductions, and exemptions as negative numbers. 2016 Taxable Income Gross income • Sarah and...

  • The​ Lees, a family of two adults and two dependent children under age​ 16, had a...

    The​ Lees, a family of two adults and two dependent children under age​ 16, had a gross annual income of ​$68,000 for 2017. Determine their standard​ deduction, exemption, and child tax credit​ amounts, as well as their marginal and average tax rates assuming their filing status is married filing jointly.Assuming the​ Lees' filing status is married filing​ jointly, their standard deduction for the 2017 tax year is ​$nothing. ​(Round to the nearest​ dollar.)  Click the following link for a standard...

  • Toby and Nancy are engaged and plan to get married. During 2017, Toby is a full-time...

    Toby and Nancy are engaged and plan to get married. During 2017, Toby is a full-time student and earns $8,500 from a part-time job. With this income, student loans, savings, and nontaxable scholarships, he is self-supporting. For the year, Nancy is employed and reports $65,000 in wages. The personal exemption amount for 2017 is $4,050. Click here to access the standard deduction table to use. If an amount is zero, enter, "0". Do not round your intermediate computations. Round your...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT