Question

Design an algorithm to accept income from the user; compute the income tax to be paid and display the income and the tax payable on the screen. 3. Income tax calculation is based on the following table. It is also available at this link: https://www.iras.gov.sg/irashome/Individuals/Locals/Working-Out-Your-Taxes/Income Tax-Rates/ (12 Marks) Chargeable Income Income Tax Rate (%) Gross Tax Payable (S) First $20,000 Next $10,000 200 First $30,000 Next $10,000 200 350 3.50 First $40,000 Next $40,000 550 2,800 First $80,000 Next $40,000 3.350 4,600 11.5 First $120,000 Next $ 40,000 7,950 6,000 15 First $160,000 Next $40,000 13,950 6,800 17 First $200.000 Next $120,000 20,750 21,600 18 42,350 First $320,000 Above $320,000 20

pls help me to write the defining algorithm,pseudo code and desk checking(2 test cases each)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

pseudo code

  • Declare the Variables
    • income, tax, grossTax;
  • Display the income
    • Please input your income
  • Start ForLoop

if ( income < 20000 )

tax = 0;

else if ( income >= 20000 && income < 30000 )

tax = 0.02;

else if ( income >= 30000 && income < 40000 )

tax = 0.035;

else if ( income >= 40000 && income < 80000 )

tax = 0.07;

else if ( income >= 80000 && income < 120000 )

tax = 0.115;

else if ( income >= 120000 && income < 160000 )

tax = 0.15;

else if ( income >= 160000 && income < 200000 )

tax = 0.17;

else if ( income >= 200000 && income < 320000 )

tax = 0.18;

else if ( income >= 320000 )

tax = 0.2;

  • End ForLoop
  • Calculate the gross Tex
    • grossTax = income * tax;
    • Print the GrossTax
    • print the LeftAmount;

End of the Pseudo Code

Code For this problem in C++;

#include <iostream>
int main() {
    float income, tax, grossTax;
    std::cout << "Please input your income" << std::endl;
    std::cin >> income;
    if ( income < 20000 ) {
        tax = 0;
    } else if ( income >= 20000 && income < 30000 ) {
        tax = 0.02;
    } else if ( income >= 30000 && income < 40000 ) {
        tax = 0.035;
    } else if ( income >= 40000 && income < 80000 ) {
        tax = 0.07;
    } else if ( income >= 80000 && income < 120000 ) {
        tax = 0.115;
    } else if ( income >= 120000 && income < 160000 ) {
        tax = 0.15;
    } else if ( income >= 160000 && income < 200000 ) {
        tax = 0.17;
    }  else if ( income >= 200000 && income < 320000 ) {
        tax = 0.18;
    } else if ( income >= 320000 ) {
        tax = 0.2;
    }
    grossTax = income * tax;
    std::cout << "Tax to be paid : " << tax * 100 << "%.\n" << "Gross tax payble : " << grossTax << "." << std::endl;
    std::cout << "Taxpayer has left : " << income - grossTax << std::endl;
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
pls help me to write the defining algorithm,pseudo code and desk checking(2 test cases each) Design...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT