Tuesday, 19 January 2016

Write A Program That input salary and tells the Tax USing functions accordin to these rules 1) NO TAX FOR FIRST 1000 2) 5% TAX FOR 2ND 1000 3) 4% TAX FOR THIRD 1000 4) 3% TAX FOR REMAINING SALARY in c++

#include<iostream>
using namespace std;
float tax(long int s);
main()
{int salary;
float Tax;
cout<<"Enter Salary :";
cin>>salary;
Tax=tax(salary);
cout<<"Tax on salary is :"<<Tax;
}
float tax(long int s)
{float tax1;
    if (s<=1000)
    {
tax1=0.0;
    cout<<"NO tax :";
}
else if(s>1000&&s<=2000)
     {
s=s-1000.0;
     tax1=5.0/100.0*1000;
}
else if(s>2000&&s<=3000)
     {
  tax1=5.0/100.0*1000.0;
       s=s-2000.0;
        tax1=tax1+(4.0/100.0*1000.0);
}
else
     {
tax1=5.0/100.0*1000.0;
     tax1=tax1+(4.0/100.0*1000);
     s=s-3000;
     tax1=tax1+(3.0/100.0*s);
     }
return tax1;}