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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started