Showing posts with label Income Class Example. Show all posts
Showing posts with label Income Class Example. Show all posts

Income Class in C++

#include<iostream.h>
#include<conio.h>
class income
{
double BS;
double DA;
   public:
void initialize(double,double);
double pay_sal();
double deduction();
double calc_tax();
void income_detail();
};
void income::initialize(double b,double d)
{
BS=b;
DA=d;
}
double income::pay_sal()
{
double HRA;
HRA = 0.15 * BS;
return (BS+DA+HRA);
}
double income::deduction()
{
double SC,PF;
SC = PF = 0.08 * BS;
return (SC+PF);
}
double income::calc_tax()
{
double sal,tax,sc;
sal = pay_sal();
sal*=12;
if(sal<100000)
{
tax = 0.2 * sal;
}
else
{
tax = 0.3 * sal;
sc  = 0.1 * tax;
tax+=sc;
}
return tax;
}
void income::income_detail()
{
cout<<"\nBasic Salary is         : "<<BS;
cout<<"\nDearness Allowance is   : "<<DA;
cout<<"\nMonthly Deduction is    : "<<deduction();
cout<<"\nTotal Monthly Salary is : "<<pay_sal();
cout<<"\nTotal Annual Salary is  : "<<12*pay_sal();
cout<<"\nAnnual Payable Tax is   : "<<calc_tax();
}
int main()
{


double bs,da;
income s;
//Initializing Income
cout<<"\nEnter Basic Pay : ";
cin>>bs;
cout<<"\nEnter Dearness Allowance : ";
cin>>da;
s.initialize(bs,da);
s.income_detail();
return 0;
}


Output:
Enter Basic Pay : 5000
Enter Dearness Allowance : 5
Basic Salary is  : 5000
Dearness Allowance is   : 5
Monthly Deduction is    : 800
Total Monthly Salary is : 5755
Total Annual Salary is  : 69060
Annual Payable Tax is   : 13812
Process returned 0 (0x0)   execution time : 36.459 s
Press any key to continue.

Labels