in a company an employee is paid as follows; if his basic salary is less than 50,000 then house allowance is 10% and inflation allowance is 5% of basic salary. if his salary is equal to or above 50,000 then his house allowance is equal to 10,000 and inflation allowance is 8% of basic salary. if the employee basic salary is input by the user, write a c++ program to find an employee's gross salary
#include<iostream>
using namespace std;
int main(){
double basic_salary;
cout<<"Enter the basic salary\n";
cin>>basic_salary;
double house_allowance, inflation_allowance;
if(basic_salary<50000){
house_allowance = basic_salary * 0.1;
inflation_allowance = basic_salary * 0.05;
}
else if(basic_salary>= 50000){
house_allowance = 10000 ;
inflation_allowance = basic_salary * 0.08;
}
double gross_pay = basic_salary + house_allowance + inflation_allowance;
cout<<"The gross pay is:\t"<<gross_pay<<endl;
}
Comments
Leave a comment