In a company an employee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If the employee's salary is input by the user write a program to find his gross salary.
using namespace std;
main(void)
{
float GrossSalary,Basic,DA,HRA;
int Flag =-1;
while(Flag)
{
Flag=-1;
while(Flag<0 || Flag>1)
{
cout<<"\n\n\nPress 1 to enter Basic Salary: ";
cout<<"\nPress 0 to QUIT.";
cout<<"\nEnter Option (1/0): "; cin>>Flag;
}
if(Flag)
{
cout<<"\n\nEnter Basic Salary: "; cin>>Basic;
if(Basic <1500)
{
HRA = (10*Basic)/100;
DA = (90*Basic)/100;
GrossSalary = Basic + HRA + DA;
}
if(Basic >= 1500)
{
HRA = 500;
DA = (98*Basic)/100;
GrossSalary = Basic + HRA + DA;
}
cout<<"\n\nBasic = "<<Basic;
cout<<"\nHRA = "<<HRA;
cout<<"\nDA = "<<DA;
cout<<"\nGross Salary = "<<GrossSalary;
}
}
}
Comments
Leave a comment