Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cmath>
- using namespace std;
- int getChildren ();
- double taxAmount(int, double, double, int);
- void getData ();
- int main ()
- {
- getData();
- int getChildren ();
- double taxAmount(int, double, double, int);
- return 0;
- }
- void getData ()
- {
- char status, answer;
- int numChildren;
- double salary, pensionAmount, deductAmount;
- int numPeople, standardExemption;
- double tax;
- cout<<"Enter 'm'arried or 's'ingle:";
- cin>>status;
- cout<<endl;
- if (status=='m'||status=='M')
- {
- numChildren=getChildren();
- standardExemption=7000;
- cout<<"Do both spouses earn an income? Enter 'Y'es or 'N'o: ";
- cin>>answer;
- cout<<endl;
- if (answer=='y'||answer=='Y')
- {
- cout<<"Please enter combined salary: ";
- cin>>salary;
- cout<<endl;
- }
- else if (answer=='n'||answer=='N')
- {
- cout<<"Please enter your salary: ";
- cin>>salary;
- cout<<endl;
- }
- numPeople=2+numChildren;
- }
- else
- {
- cout<<"Please enter your salary: ";
- cin>>salary;
- cout<<endl;
- standardExemption=4000;
- numPeople=1;
- }
- cout<<"Please enter pension plan amount: ";
- cin>>pensionAmount;
- cout<<endl;
- }
- int getChildren ()
- {
- int children;
- cout<<"Enter number of children under 14: ";
- cin>>children;
- cout<<endl;
- return children;
- }
- double taxAmount(int, double, double, int)
- {
- int numPeople;
- double tax;
- double salary, pensionAmount;
- int standardExemption;
- int amountoftax;
- if (salary <=15000.00)
- {
- amountoftax=(salary-((numPeople*1500.00)+pensionAmount+standardExemption))*15%;
- }
- else if (salary>15000.00||salary<=40000.00)
- {
- amountoftax=2250.00+((((numPeople*1500.00)+pensionAmount+standardExemption))-15000.00)*25%;
- }
- else (salary>40000.00);
- {
- amountofTax=8460.00+((((numPeople*1500.00)+pensionAmount+standardExemption))-40000.00)*35%);
- tax = taxAmount(numPeople, salary, pensionAmount, standardExemption);
- cout<<"Your tax amount is: "<<tax<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement