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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:00, jc624826
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
image
Computers and Technology, 23.06.2019 06:20, Ab20600
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
image
Computers and Technology, 23.06.2019 21:40, gaby06
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
image
Computers and Technology, 24.06.2019 03:30, etxchrissy
What is the purpose of a computer network needs assessment? to analyze which workers need more training to improve their performance to compare worker productivity to determine what steps employees can take to increase company revenue to evaluate how to move from the current status to the desired goal
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 in other subjects:

Konu
Mathematics, 16.05.2021 03:00
Konu
Physics, 16.05.2021 03:00