Question

In C++ Write a function that has an double as a parameter and returns a double...

In C++ Write a function that has an double as a parameter and returns a double through the function call. (Be Original)
                                           

The parameter is the income for a single person and the return value is the amount of income tax owed.

                                             Use the Schedule X – Single table below.              

                                             
                                            Write a main function to test the function you have written.

                                             You are required to used

                                                                nested if … else if … else if … else

                                                                to determine the calculation to use for the tax.

Schedule X — Single

If taxable income is  over--

But not over--

The tax is:

$0

$7,550

10% of the amount over $0

$7,550

$30,650

$755 plus 15% of the amount over 7,550

$30,650

$74,200

$4,220.00 plus 25% of the amount over 30,650

$74,200

$154,800

$15,107.50 plus 28% of the amount over 74,200

$154,800

$336,550

$37,675.50 plus 33% of the amount over 154,800

$336,550

no limit

$97,653.00 plus 35% of the amount over 336,550

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

#include <iostream>

using namespace std;

double getTax(double income){

  double tax=0;

  if(income<=7550){

    tax=income*0.1;

  }

//checkinf for slab1

  if(income>7550 && income<=30650){

    tax=755;

    tax=tax+(income-7550)*0.15;

  }

//checkinf for slab2

  if(income>30650 && income<=74200){

    tax=755;

    tax=tax+(30650-7550)*0.15;

    tax=tax+(income-30650)*0.25;

  }

//checkinf for slab3

  if(income>74200 && income<=154800){

    tax=755;

    tax=tax+(30650-7550)*0.15;

    tax=tax+(74200-30650)*0.25;

    tax=tax+(income-74200)*0.28;

  }

//checkinf for slab4

  if(income>154800 && income<=336550){

    tax=755;

    tax=tax+(30650-7550)*0.15;

    tax=tax+(74200-30650)*0.25;

    tax=tax+(154800-74200)*0.28;

    tax=tax+(income-154800)*0.23;

    

  }

//checkinf for slab5

  if(income>336550){

    tax=755;

    tax=tax+(30650-7550)*0.15;

    tax=tax+(74200-30650)*0.25;

    tax=tax+(154800-74200)*0.28;

    tax=tax+(336550-154800)*0.33;

    tax=tax+(income-336550)*0.35;

  }

  return tax;

  

}

int main(){

double income;

cout<<"Enter income: ";

cin>>income;

cout<<"Tax : "<<getTax(income);

}

Add a comment
Know the answer?
Add Answer to:
In C++ Write a function that has an double as a parameter and returns a double...
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
  • 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...

  • Arabella Cunningham is 24 years old and single, lives in an apartment, and has no dependents....

    Arabella Cunningham is 24 years old and single, lives in an apartment, and has no dependents. Last year she earned $38,500 as a sales representative for Planning Associates; $2,695 of her wages was withheld for federal income taxes. In addition, she had interest income of $135. The standard deduction in 2018 was $12,000 for single. The appropriate tax rate schedule is shown below: EXHIBIT 3.3 Sample Tax Rate Schedules Tax rates levied on personal income vary with the amount of...

  • Required information Problem 8-47 (LO 8-1) [The following information applies to the questions displayed below.] Whitney...

    Required information Problem 8-47 (LO 8-1) [The following information applies to the questions displayed below.] Whitney received $74,200 of taxable income in 2019. All of the income was salary from her employer. What is her income tax liability in each of the following alternative situations? Use Tax Rate Schedule for reference. (Do not round intermediate calculations. Round your answer to 2 decimal places.) a. She files under the single filing status. A. Income tax liability: ??? b. She files a...

  • Use Tax Rate Schedule Carson Wentz, of Philadelphia, determined the following tax information: salary, $163,000; interest...

    Use Tax Rate Schedule Carson Wentz, of Philadelphia, determined the following tax information: salary, $163,000; interest earned, $2,000; qualified retirement plan contribution, $4,000; personal exemption, $4,050; itemized deductions, $11,000. Filing single, calculate Carson's taxable income and tax liability. (Hint: Use Table 4-2.) Round your answer for tax liability to the nearest cent. Table 4-2 Tax Rate Schedules DO IT IN CLASS Single Individuals If taxable income is over- 0 But not over- $ 9,275 $ 37,650 $ 91,150 $190,150 $413,350...

  • Ing Your laxes Estimating taxable income, tax liability, and potential refund Arabella Cunningham is 24 years...

    Ing Your laxes Estimating taxable income, tax liability, and potential refund Arabella Cunningham is 24 years old and single, lives in an apartment, and has no dependents. Last year she earned $42,100 as a sales representative for Planning Associates; $3,368 of her wages was withheld for federal income taxes. In addition, she had interest income of $169. The standard deduction in 2018 was $12,000 for single. The appropriate tax rate schedule is shown below: EXHIBIT 3.3 Sample Tax Rate Schedules...

  • C++ //get_letter_grade.h /* Write a function gpa_to_letter_grade that returns a string and accepts a double gpa...

    C++ //get_letter_grade.h /* Write a function gpa_to_letter_grade that returns a string and accepts a double gpa parameter */ //get_letter_grade.cpp /* Write function code for gpa_to_letter_grade that returns a string and accepts a double gpa parameter YOU MUST USE A SWITCH STATEMENT Given a double 3.5 returns the string A TIP: You'll have to convert the double to an int using multiplication Table 3.5 to 4 returns an A 3.0 to 3.49 returns a B 1.7 to 2.99 returns a C...

  • 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...

  • 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...

  • Jared Goff, of Los Angeles, determined the following tax information: gross salary, $120,000; interest earned, $2,000;...

    Jared Goff, of Los Angeles, determined the following tax information: gross salary, $120,000; interest earned, $2,000; IRA contribution, $4,000; personal exemption, $4,050; and itemized deductions, $8,000. Calculate Jared’s taxable income and tax liability filing single. (Hint: Use Table 4-2.) Round your answer for taxable income to the nearest dollar and answer for tax liability to the nearest cent. Table 4-2 Tax Rate Schedules DO IT IN CLASS Single Individuals If taxable income is over- 0 But not over- $ 9,275...

  • (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...

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