The tax payable on taxable incomes for employees in a certain country is set out in the following table:

0 – \$18,200 Nil
\$18,201 – \$37,000 19c for each \$1 over \$18,200
\$37,001 – \$80,000 \$3,572 plus 32.5c for each \$1 over \$37,000
\$80,001 – \$180,000 \$17,547 plus \$37c for each \$1 over \$80,000
\$180,001 and over \$54,547 plus 45c for each \$1 over \$180,000

Design an algorithm that will read as input the taxable income amount and calculate and print the tax payable on that amount.

To get people to help you with your code, you would need to provide some. But let me give you a couple of hints.

Step 1: "Read as input the taxable income amount"
This can be done with a simple cin or getline statement to store the taxable income amount.

Step 2: "Calculate tax payable on that amount and print that amount"
This could be done with either a switch statement or a series of if statements.
Here's an example:

 ``123456789101112`` ``````If (input > 18,200 && input < 37,000 then){ //this is where the "Algorithm" comes into play input = input - 18,200; //this will obtain how many dollars over \$18,200 input = input * .19; //19 cents to each dollar, this is how much they pay cout<<"\$"<

It's going to be a little different for the other values because you'll need to add the initial values as well (3,572,17,547,ect).
Thanks for the help, and yer i know i didnt give any actual code but i didnt even know how i'd start.

The code below (shown on line 1) shouldn't have a "then" in it.

`If (input > 18,200 && input < 37,000 then){`

Also its between 18,201 - 37,000 so you would need to do a lower than or equal to <= rather than just lower than < otherwise 37,000 would be skipped over.

You are correct Softrix. The then was meant to be commented out and technically you could just change 37,000 to 37,001 as well. I didn't write anything in my compiler was just giving him an idea of what needed to be done.

Anyway, thanks for the catch.
Topic archived. No new replies allowed.