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, 22.06.2019 17:30
Under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 23.06.2019 01:50
Free points just awnser this. what should i watch on netflix
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Best laptops for college [$100-$500 range]?
Answers: 2
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
question
Mathematics, 13.07.2019 06:00
question
Mathematics, 13.07.2019 06:00
question
Mathematics, 13.07.2019 06:00
question
Mathematics, 13.07.2019 06:00
question
Mathematics, 13.07.2019 06:00
question
Mathematics, 13.07.2019 06:00
Questions on the website: 13722360