0

include <iostream>

include <cmath>

using namespace std;

int main()

{


char flag;
float emp_no,basic,da ,hra,pf,tax,net_salary,total_salary;
cout<<"enter the basic salary & employee no.";
cin>>basic>>emp_no;
if(basic<=5000)
    flag=0;
else if(basic>5000&&basic<=15000)
    flag=1;
else if(basic>1500 && basic<=25000)
    flag=2;
switch(flag)
{
    case '0':
        tax=0;
        da=(25/100)*basic;
        hra=(20/100)*basic;
        pf=(5/100)*basic;
        break;
    case '1':
        tax=(10/100)*basic;
        da=(25/100)*basic;
        hra=(20/100)*basic;
        pf=(10/100)*basic;
        break;
    case '2':
        tax=(15/100)*basic;
        da=(35/100)*basic;
        hra=(25/100)*basic;
        pf=(15/100)*basic;
        break;
    default:
        tax=(20/100)*basic;
        da=(50/100)*basic;
        hra=(30/100)*basic;
        pf=(20/100)*basic;

}
net_salary=basic+da+hra;
total_salary=net_salary-pf-tax;
cout<<"the net salary of emplpyee no."<<emp_no<< "is"<<(basic+da+hra);
cout<< "and the total salary is "<<total_salary;
return 0;
2
Contributors
2
Replies
11
Views
3 Years
Discussion Span
Last Post by Moschops
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.