A company decided to give bonus to employee according to following criteria: Time period of Service Bonus if More than 10 years 10% if >=6 and <=10 8% if Less than 6 years 5%. Ask user for their salary and years of service and print the net bonus amount.
#include <iostream>
using namespace std;
int main() {
float salary;
float netBonusAmount=-1;
int numberYearsWorked;
cout<<"Ente the salary: ";
cin>>salary;
cout<<"Ente the number of years of service: ";
cin>>numberYearsWorked;
if(numberYearsWorked>=6 && numberYearsWorked<=10){
netBonusAmount=0.08*salary;
}else if(numberYearsWorked>10 ){
netBonusAmount=0.1*salary;
}else{
netBonusAmount=0.05*salary;
}
if(netBonusAmount>0 && salary>0){
cout<<"The net bonus amount: "<<netBonusAmount<<"\n\n";
}else{
cout<<"Wrong data\n\n";
}
system("pause");
return 0;
}
Comments
Leave a comment