Question

IN C++ PLEASE!! In 1789, Benjamin Franklin is known to have written “Our new Constitution is...

IN C++ PLEASE!!

In 1789, Benjamin Franklin is known to have written “Our new Constitution is now established, and has an appearance that promises permanency; but in this world nothing can be said to be certain, except death and taxes.”  Our federal tax system is a “graduated” tax system which is broken into seven segments. Essentially, the more you make, the higher your tax rate. For 2018, you can find the tax brackets here.  Your task is to design (pseudocode) and implement (source code) a program that asks the user for a salary and calculates the federal tax owed.   Note, that only the money abovea particular tax bracket gets taxed at the higher rate.  For example, if someone makes $10,000 a year, the first $9525 gets taxed at 10%.  The “excess” above that ($475) gets taxed at 12%.   Note: work through at least three (3) examples of this by hand before designing the code.  It will save you significant time.  Still having problems?  Have you talked to a GTA recently?

Homework Answers

Answer #1

The code will be:-  

The rates are -

10% Up to $9,525
12% $9,526 to $38,700
22% $38,701 to $82,500
24% $82,501 to $157,500
32% $157,501 to $200,000
35% $200,001 to $500,000
37% over $500,000

According to this, the code is

#include <iostream>

using namespace std;

int main() {
double tax=0.0;
double salary;
cout<<"Enter salary: ";
cin>>salary;
if(salary>500000){
tax+=(salary-500000)*0.37;
salary=500000;
}
if(salary>200000){
tax+=(salary-200000)*0.35;
salary=200000;
}
if(salary>157500){
tax+=(salary-157500)*0.32;
salary=157500;
}
if(salary>82500){
tax+=(salary-82500)*0.24;
salary=82500;
}
if(salary>38700){
tax+=(salary-38700)*0.22;
salary=38700;
}
if(salary>9525){
tax+=(salary-9525)*0.12;
salary=9525;
}
tax+=salary*0.1;
  
cout<<"The tax owed is "<<tax<<"\n";
  
  
  
}

Know the answer?
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
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT