Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. /*
  2. Homework Assignment 3
  3. Alfred Ly
  4. Windows 7, Codeblocks, GCC compiler
  5. This is a program to calculate your tax owed or tax refund of a person.
  6. */
  7. #include <iostream>
  8. #include <iomanip>
  9. #include <math.h>
  10. #include <string>
  11. using namespace std;
  12.  
  13. const double TAXRATE1 = 0.15; //1st tax bracket 15% tax rate
  14. const double TAXRATE2 = 0.28; //2nd tax bracket 28% tax rate
  15. const double TAXRATE3 = 0.35; //3rd tax bracket 35% tax rate
  16.  
  17. int main(void)
  18. {
  19. //declaring variables
  20. double taxableIncome, taxWithheld, taxowed;
  21. double tax_liability_one, tax_liability_two, tax_liability_three, total_tax_liability;
  22.  
  23. //idFunction
  24.  
  25.  
  26. //receive input from user
  27. cout << "Enter taxableIncome and taxWithheld" << endl;
  28. cin >> taxableIncome >> taxWithheld;
  29.  
  30. if (taxableIncome < 0)
  31.  
  32. else if (taxableIncome <= 36900)
  33. {
  34. tax_liability_one = TAXRATE1 * taxableIncome;
  35. total_tax_liability = tax_liability_one;
  36. }
  37. else if(taxableIncome > 36,900 && taxableIncome <= 186,350)
  38. {
  39. tax_liability_one = TAXRATE1 * 36900;
  40. tax_liability_two = TAXRATE2 * (186350-taxableIncome);
  41. total_tax_liability = tax_liability_one + tax_liability_two;
  42. }
  43. else if (taxableIncome > 186350)
  44. {
  45. tax_liability_one = TAXRATE1 * 36900;
  46. tax_liability_two = TAXRATE2 * 186350;
  47. tax_liability_three = TAXRATE3 * taxableIncome;
  48. total_tax_liability = tax_liability_one + tax_liability_two + tax_liability_three;
  49. }
  50. else
  51. {
  52. taxowed = taxWithheld;
  53. }
  54.  
  55. // display out to user
  56. cout << fixed;
  57. cout.precision(4);
  58.  
  59.  
  60. //testing
  61. cout << total_tax_liability <<endl;
  62. cout << taxWithheld << endl;
  63.  
  64. return 0;
  65. } //ending bracket
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement