Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double salary, tax;
- char married, newArrival;
- int noOfChildren;
- const double MARRIED_TAX_REDUCTION = 0.02;
- const double PER_CHILD_TAX_REDUCTION = 0.005;
- const double NEWLY_ARRIVED_TAX_REDUCTION = 0.08;
- cout << "Enter your salary in CAD" << endl;
- cin >> salary;
- cout << "\nAre you married? (Enter \"Y\" or \"N\")" << endl;
- cin >> married;
- cout << "\nHave you arrived in the province recently? (Enter \"Y\" or \"N\")" << endl;
- cin >> newArrival;
- cout << "\nHow many children do you have?" << endl;
- cin >> noOfChildren;
- if (salary <= 18000) {
- tax = 0.10 ;
- } else if (salary > 18000 && salary <= 32000) {
- tax = 0.20 ;
- } else if (salary > 32000 && salary <= 60000) {
- tax = 0.30 ;
- } else if (salary > 60000) {
- tax = 0.40 ;
- }
- if (married == 'Y' || married == 'y') {
- tax = tax - MARRIED_TAX_REDUCTION;
- }
- if (noOfChildren > 0) {
- tax = tax - (noOfChildren * PER_CHILD_TAX_REDUCTION);
- }
- if (newArrival == 'Y' || newArrival == 'y') {
- tax = tax - NEWLY_ARRIVED_TAX_REDUCTION;
- }
- cout << "Total tax to pay : " << salary * tax << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement