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 00:00
11. is the ability to understand how another person is feeling. a. authority b. sympathy c. empathy d. taking a stand
Answers: 1
question
Computers and Technology, 22.06.2019 01:20
What is the full meaning of rfid in computer
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
question
Computers and Technology, 22.06.2019 15:00
Hyperactive media sales has 10 windows 7 laptop computers used by sales-people in the organization. each laptop computer has several customized applications that are used during the sales process as well as customer relationship management software. all of the applications on the laptops are difficult to configure and have large data files. if all of the laptops have current hardware, what is the easiest way to install windows 10 on them?
Answers: 1
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: 13722367