Question: I need help using an if-else chain to compute income taxes. Example: Requirements READ THIS SECTION CAREFULLY For full credit, your code must.... 1. Compile
I need help using an if-else chain to compute income taxes.


Example:



Requirements READ THIS SECTION CAREFULLY For full credit, your code must.... 1. Compile without errors. (20 points) 2. Run without errors. (20 points) 3. Your C file must be properly indented. (10 points) 4. When run, the first line of your program's output should be (5 points): Income? 5. After printing the first line, your program should read in a decimal number representing the income in dollars and cents) for which we want to compute the taxes. (5 points) For example, the user may enter 5000.99 to represent five thousand dollars and ninety nine cents. I will not enter 0.00, negative numbers, or any number bigger than 1 million (1000000.00). You do not need to handle these values. 6. After accepting the input, your program should correctly compute two values: O The total tax for the given income using the tax table provided (15 points) o The effective tax rate for the given tax, which is the total tax divided by the income, expressed as a percentage (10 points) 7. After the value is computed, your program should print the following line: Total Tax: ? But replace the ? with the total tax. (5 points) a) The beginning of the line should be exactly "Total Tax: above as shown b) The value should be given in dollars and cents. c) The value should not be preceded by a $. d) The value should be printed with exactly 2 decimal places. e) The value should be accurate to a penny. 8. On the next line, your program should print: Tax Rate: ? But replace the ? with the value of the effective tax rate. (5 points) a) The beginning of the line should be exactly "Tax Rate: ", as shown above b) The value should be given as a percentage (a number between 0 and 100). c) The value should not be followed by a %. d) The percentage should be printed with exactly 1 decimal place (Example: 12.5). e) The value should be accurate to a tenth of a percent (0.1%). 9. When printed, both the tax rate and the effective tax rate should have their right- most characters line up. You may assume that I will not input any incomes larger than $1 million (1000000.00). (5 points) For example, an input of 1000000.00 should print out: Total Tax: 334426.09 Tax Rate: 33.4 Attach your .c file to this assignment as your submission. Example Program Output When you run your program, you should first see this: Income? Example Output 1 If I want to compute the taxes for $20,000.00 I would type in 20000.00 like so, then hit enter: Income? 20000.00 The program should output: 2202.50 Total Tax: Tax Rate: Example Output 2 If I want to compute the taxes for $1,000,000.00 I would type in 1000000.00 like so, then hit enter Income? 1000000.00 The program should output Total Tax: 334427.00 Tax Rate: 33.4 How to compute income tax and effective tax rate The following is the 2020 tax table (for single individuals). Tax Rate 10% 12% 22% 24% 32% 35% 37% Tax Bracket Up to $9,875 $9,876 to $40,125 $40,126 to $85,525 $85 526 to S163,300 $163,301 to $207,350 $207,351 to $518,400 $518,401 or more If you've never done your taxes, it can be tricky to understand how the tax table works. The best way to understand how income taxes work is through examples. Example 1: Income between $0 and $9,875 Suppose I earned $5,000, here is how I compute my taxes: 141 tax bracket: Because I earned less than $9,875, I will pay 10% on any income beyond SO. ($5,000 - $0) 10% = $5,000 - 10% = $500.00 My total taxes are $500.00 My effective tax rate is: $500 / $5000 = 10.0% Example 2: Income between $9,875 and $40,125 Suppose I earned $20,000, here is how I compute my taxes: 141 tax bracket: Because I earned more than $9,875, I will first pay 10% of $9,875 minus $0 ($9,875 - SO) 10% = $9,875' 10% = $987.50 2nd tax bracket: Because I earned less than $40,125, I will also pay 12% on any income beyond $9,875. ($20,000 - $9,875) 12% = $10,125 12% = $1,215 Total Tax: To compute my taxes, I sum those up. $987.50 + $1,215 = $2,202.50 My effective tax rate is: $2,202.50 / $20,000 11.0% Example 3: Income between $40,125 and $85.525 Suppose I earned $60,000, here is how I compute my taxes: 101 tax bracket: Because I earned more than $9,875, I will first pay 10% of $9,875 minus $0. $9,875 10% = $987.50 2nd tax bracket: Because I earned more than $40,125, I will also pay 12% of $40,125 minus $9,875 ($40,125 - $9,875) 12% = $30,250" 12% = $3,630 3d tax bracket: Because I earned less than $85,525, I will pay 22% of $60,000 minus $40,125. ($60,000 - $40,125) 22% = $19,875 22% = $4,372.50 Total Tax: To compute my taxes, I sum those up. $987.50 + $3,630+ $4,372,50 = $8,990.00 My effective tax rate is: $8,990 / $60,000 - 15.0 %
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
