wcypierre

tax

Oct 10th, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.17 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     double income, tax;
  6.     int status;
  7.  
  8.     cout<<"Enter your income : "<<endl;
  9.     cin>>income;
  10.  
  11.     if (income < 0){
  12.         cout<<"invalid income"<<endl;
  13.     }
  14.     else{
  15.         cout<<"Invalid status"<<endl;
  16.         main();
  17.     }
  18.  
  19.     cout<<"Enter your filling status 0 is for single and 1 is for married jointly : "<<endl;
  20.     cin>>status;
  21.  
  22.     if (status == 0){
  23.         if (income <= 6000)
  24.             tax = income * 0.10;
  25.         else if (income <= 28000)
  26.             tax = 6000 * 0.10 + (income - 6000) * 0.15;
  27.         else if (income <= 67700)
  28.             tax = 6000 * 0.10 + (28000 - 6000) * 0.15 + (income - 28000) * 0.27;
  29.         else if (income <= 141250)
  30.             tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (income - 67700) * 0.30;
  31.         else if (income <= 307050)
  32.             tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (income - 141250) * 0.35;
  33.         else
  34.             tax = 6000 * 0.10 + (28000 - 6000) * 0.15 + (67700 - 27950) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (307050 - 141250) * 0.35 + (income - 307050) * 0.386;
  35.     }
  36.     else if (status == 1){
  37.         if (income <= 6000)
  38.             tax = (income * 0.10)*0.83;
  39.         else if (income <= 28000)
  40.             tax = (6000 * 0.10 + (income - 6000) * 0.15) * 0.83;
  41.         else if (income <= 67700)
  42.             tax = (6000 * 0.10 + (28000 - 6000) * 0.15 + (income - 67700) * 0.27) * 0.83;
  43.         else if (income <= 141250)
  44.             tax = (6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (income - 67700) * 0.30) * 0.83;
  45.         else if (income <= 307050)
  46.             tax = (6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (income - 141250) * 0.35) * 0.83;
  47.         else
  48.             tax = (6000 * 0.10 + (28000 - 6000) * 0.15 + (67700 - 27950) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (307050 - 141250) * 0.30 + (income - 307050) * 0.386) * 0.83;
  49.     }
  50.  
  51.  
  52.     cout<<"Tax is"<<static_cast<int>(tax * 100) / 100<<endl;
  53.  
  54.     system("pause");
  55.     return 0;
  56. }
  57.  
  58.  
Advertisement
Add Comment
Please, Sign In to add comment