Question #42701
Design an algorithm to accept income from the user; compute the income tax to be
paid and display on the screen. Income tax is based on the following table available
at this link: http://iras.gov.sg/irasHome/page04.aspx?id=1190 (Note: Choose
Resident Individuals) ->( include desk check, input data, expected result and desk checking table)
1
Expert's answer
2014-05-22T08:51:54-0400
#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;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS