Advertisement
Go0dtry

tax program again

Nov 28th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int getChildren ();
  8.  
  9. double taxAmount(int, double, double, int);
  10.  
  11. void getData ();
  12.  
  13. int main ()
  14.  
  15. {
  16. getData();
  17. int getChildren ();
  18. double taxAmount(int, double, double, int);
  19. return 0;
  20. }
  21.  
  22. void getData ()
  23.  
  24. {
  25. char status, answer;
  26. int numChildren;
  27. double salary, pensionAmount, deductAmount;
  28. int numPeople, standardExemption;
  29. double tax;
  30.  
  31. cout<<"Enter 'm'arried or 's'ingle:";
  32. cin>>status;
  33. cout<<endl;
  34.  
  35. if (status=='m'||status=='M')
  36. {
  37. numChildren=getChildren();
  38. standardExemption=7000;
  39.  
  40. cout<<"Do both spouses earn an income? Enter 'Y'es or 'N'o: ";
  41. cin>>answer;
  42. cout<<endl;
  43.  
  44. if (answer=='y'||answer=='Y')
  45. {
  46. cout<<"Please enter combined salary: ";
  47. cin>>salary;
  48. cout<<endl;
  49. }
  50. else if (answer=='n'||answer=='N')
  51. {
  52. cout<<"Please enter your salary: ";
  53. cin>>salary;
  54. cout<<endl;
  55. }
  56. numPeople=2+numChildren;
  57. }
  58. else
  59. {
  60. cout<<"Please enter your salary: ";
  61. cin>>salary;
  62. cout<<endl;
  63. standardExemption=4000;
  64. numPeople=1;
  65. }
  66.  
  67. cout<<"Please enter pension plan amount: ";
  68. cin>>pensionAmount;
  69. cout<<endl;
  70. }
  71.  
  72. int getChildren ()
  73.  
  74. {
  75. int children;
  76.  
  77. cout<<"Enter number of children under 14: ";
  78. cin>>children;
  79. cout<<endl;
  80.  
  81. return children;
  82.  
  83. }
  84.  
  85. double taxAmount(int, double, double, int)
  86. {
  87.  
  88. int numPeople;
  89. double tax;
  90. double salary, pensionAmount;
  91. int standardExemption;
  92. int amountoftax;
  93.  
  94.  
  95. if (salary <=15000.00)
  96. {
  97.  
  98. amountoftax = ((salary-((numPeople*1500.00)+ pensionAmount+ (standardExemption))*0.15);}
  99.  
  100. else if (salary>15000.00 and salary<=40000.00){
  101.  
  102. amountoftax=2250.00+(((((numPeople*1500.00)+pensionAmount+standardExemption))-15000.00)*0.25);}
  103.  
  104. else (salary>40000.00);{
  105.  
  106. amountoftax=8460.00+(((((numPeople*1500.00)+pensionAmount+standardExemption))-40000.00)*0.35);
  107.  
  108.  
  109. tax = taxAmount(numPeople, salary, pensionAmount, standardExemption);
  110.  
  111.  
  112. cout<<"Your tax amount is: "<<tax<<endl;
  113. }
  114.  
  115. return 0;
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement