Question: program in c. Please write comments so I could UNDERSTAND the code. Thank you. 5. Write a function that determines the tax amount according to

program in c. Please write comments so I could UNDERSTAND the code. Thank you.

5. Write a function that determines the tax amount according to the following tax rules. The tax rate depends on the income, the marital status, and the state residency. For in state residents, the following rates apply. If single and income is less than 30000 then tax rate is 20%. If single and income is greater or equal to 30000 then tax rate is 25%. If married and income is less than 50000 then tax rate is 10%. If married and income is greater or equal to 50000 then tax rate is 15%. For out of state residents, the similar rules apply except the tax rate is 3% less than the tax rate of the corresponding in state residents. The function prototype is double compute_tax(int income, char *status, char state). The income is positive integer. The status is string single or married in lower or upper case letters. The state is character i or o in lower or upper case letters. The function computes and returns the tax amount. If any input is invalid then the function returns -1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!