subject

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: a. function getdata: this function asks the user to enter the relevant data. b. 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.)

include #include using namespace std; int getnumchildren(); double taxamount(int, double, double, int); int main () { void getdata(); getdata(); return 0; } void getdata() { char status, answer; int noofchildren; double salary, amtinpension, amtdeducted; int numperson, standardexemption; double tax; cout < < " enter your marital status: married or single "; cin > > status; cout < < endl; if (status == 'm' || status == 'm') { noofchildren = getnumchildren(); standardexemption = 7000; cout < < "do both spouses earn income? enter yes or no. "; cin > > answer; cout < < endl; if (answer == 'y' || answer == 'y') { cout < < " enter your combined salary: "; cin > > salary; cout < < endl; } else if (answer == 'n' || answer == 'n') { cout < < " enter salary: "; cin> > salary; cout< < endl; } numperson = 2 + noofchildren; } else { cout < < " enter your salary: "; cin > > salary; cout < < endl; standardexemption = 4000; numperson = 1; } cout < < " enter amount that you want to contribute to the pension plan: "; cin > > amtinpension; cout < < endl; tax = taxamount(numperson, salary, amtdeducted, standardexemption); } int getnumchildren() { int children; cout < < " enter number of children under the age of 14: "; cin > > children; cout < < endl; return children; } double taxamount(int numperson, double salary, double amtinpension, int standardexemption) { double tax; double taxableincome; taxableincome = salary - (1500.00 * numperson) - amtinpension - standardexemption; if (taxableincome < 15000) tax = .15 * taxableincome ; else if (taxableincome < 4) tax = (.25 * (taxableincome - 15000) + 2250); else if (taxableincome > 40001) tax = (.35 * (taxableincome - 4) + 8460); cout < < "the tax is: " < < tax < < endl; system ("pause"); return (tax); }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 04:00
In a word processing program, such as microsoft word, which feature to you choose the desired picture enhancement?
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
What is the penalty for violating section 1201 of title 17 chapter 21 of the us code
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
question
Computers and Technology, 23.06.2019 23:40
4. what is the reason for including the following code snippet in the header file animal.h? #ifndef animal_h #define animal_h class animal { public: animal(); animal(double new_area_hunt); void birth(); void hunt(double new_area_hunt); void death(); double get_area_hunt() const; private: double area_hunt; }; #endif
Answers: 3
You know the right answer?
Write a program that can be used to calculate the federal tax. the tax is calculated as follows: fo...
Questions
Questions on the website: 13722363