Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. double salary, tax;
  7. char married, newArrival;
  8. int noOfChildren;
  9. const double MARRIED_TAX_REDUCTION = 0.02;
  10. const double PER_CHILD_TAX_REDUCTION = 0.005;
  11. const double NEWLY_ARRIVED_TAX_REDUCTION = 0.08;
  12. cout << "Enter your salary in CAD" << endl;
  13. cin >> salary;
  14. cout << "\nAre you married? (Enter \"Y\" or \"N\")" << endl;
  15. cin >> married;
  16. cout << "\nHave you arrived in the province recently? (Enter \"Y\" or \"N\")" << endl;
  17. cin >> newArrival;
  18. cout << "\nHow many children do you have?" << endl;
  19. cin >> noOfChildren;
  20.  
  21. if (salary <= 18000) {
  22. tax = 0.10 ;
  23. } else if (salary > 18000 && salary <= 32000) {
  24. tax = 0.20 ;
  25. } else if (salary > 32000 && salary <= 60000) {
  26. tax = 0.30 ;
  27. } else if (salary > 60000) {
  28. tax = 0.40 ;
  29. }
  30.  
  31. if (married == 'Y' || married == 'y') {
  32. tax = tax - MARRIED_TAX_REDUCTION;
  33. }
  34.  
  35. if (noOfChildren > 0) {
  36. tax = tax - (noOfChildren * PER_CHILD_TAX_REDUCTION);
  37. }
  38.  
  39. if (newArrival == 'Y' || newArrival == 'y') {
  40. tax = tax - NEWLY_ARRIVED_TAX_REDUCTION;
  41. }
  42.  
  43. cout << "Total tax to pay : " << salary * tax << endl;
  44.  
  45. system("pause");
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement