Advertisement
ramonguzman

Untitled

Jan 23rd, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. const double S_ONE = 863;
  6. const double S_TW0 = 864;
  7. const double S_THREE = 2588;
  8. const double S_FOUR = 2589;
  9. const double S_FIVE = 4313;
  10.  
  11. const double M_ONE = 1726;
  12. const double M_TW0 = 5176;
  13. const double M_THREE = 5177;
  14. const double M_FOUR = 8626;
  15. const double M_FIVE = 4313;
  16.  
  17.  
  18.  
  19. int main()
  20. {
  21.     double income;
  22.     double tax;
  23.  
  24.     double rates[] = {0.023,0.033,0.052,0.075};
  25.     double single[] = {25,85,181};
  26.     double married[] = {40,175,390};
  27.  
  28.     cout << "please enter your income: ";
  29.     cin >> income;
  30.  
  31.     cout << "martial please enter your martial status (s or m):" ;
  32.     string martialStatus;
  33.     cin >> martialStatus;
  34.    
  35.     if (martialStatus == "s")
  36.     {
  37.         if (income <= 0 || income >= S_ONE)
  38.         {
  39.             tax = ((income - 0) * rates[1]) + 0;
  40.             cout << "your income tax is: " << tax;
  41.         }
  42.         else if (income <= S_TW0 || income >= S_THREE)
  43.         {
  44.             tax = ((income - S_ONE) * rates[2]) + single[1];
  45.             cout << "your income tax is: " << tax;
  46.         }
  47.         else if (income <= S_FOUR || income >= S_FIVE)
  48.         {
  49.             tax = ((income - S_THREE) * rates[3]) + single[85];
  50.             cout << "your income tax is: " << tax;
  51.         }
  52.         else if (income <= S_FIVE)
  53.         {
  54.             tax = ((income - S_FIVE) * rates[4]) + single[3];
  55.             cout << "your income tax is: " << tax;
  56.         }      
  57.     }
  58.  
  59.     else
  60.     {
  61.         if (income <= 0 || income >= M_ONE)
  62.         {
  63.             tax = ((income - 0) * rates[1]) + 0;
  64.             cout << "your income tax is: " << tax;
  65.         }
  66.         else if (income <= M_TW0 || income >= M_THREE)
  67.         {
  68.             tax = ((income - M_ONE) * rates[2]) + single[1];
  69.             cout << "your income tax is: " << tax;
  70.         }
  71.         else if (income <= M_FOUR || income >= M_FIVE)
  72.         {
  73.             tax = ((income - S_THREE) * rates[3]) + single[85];
  74.             cout << "your income tax is: " << tax;
  75.         }
  76.         else if (income <= M_FIVE)
  77.         {
  78.             tax = ((income - M_FIVE) * rates[4]) + single[3];
  79.             cout << "your income tax is: " << tax;
  80.         }
  81.     }
  82.     cin.get();
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement