A company pays its employees' salary as follows:
The company pays 6000 AED for rank 'D', 7000 AED for rank 'C', 8000 AED for rank 'B', and 9000 AED for rank 'A'.
The company also pays Experience allowance, 10% of the basic salary for every year of experience and the company pays child allowance as of 500 AED per child up to 3 children; if more than 3 children, the company pays fixed amount of 2000 AED.
Write a C++ program to calculate the total salary for an employee; let your program accept the rank of an employee, number of children, and number of years of experience.
Sample output:
Enter the Employee Rank: B
Enter Number of Years: 5
Enter Number of Children: 2
Total Salary is 13000.00
**************************************************************
#include<iostream>
using namespace std;
int main(){
int rank,year;
double basic,exrate=0.10,exallowance;
int year,child;
cout<<"Enter the Employee Rank: ";
cin>>rank;
cout<<"Enter Years of Experience:";
cin>>year;
cout<<"Enter Number of Children:";
cin>>child;
cout<<""<<endl;
switch (rank){
case 1:
D=6000;
break;
case 2:
C=7000;
break;
case 3:
B=8000;
break;
case 4:
A=10000;
break;
default:
cout<<" your grade is out of rank"<<endl;
}
double totalsalary,childallowance;
exallowance=year*exrate;
if(child==3)
childallowance=500;
else
if(child>3)
childallowance=2000;
else
childallowance=0;
totalsalary=exallowance+childallowance;
cout<<"Totalsalary is"<<totalsalary<<"AED"<<endl;
return 0;
}
