Write a program that able to compute the pay of both types of employees: retired one’s and employed,
the retired employees will receive pension and it will be computed and displayed with proper variables
and messages. The pension of the employer will be fixed and will be computed on the basis of age, if the
age of the retired employer is between 60 to 70 years then its pension will be 30000 and if the age is
greater than 70 then the pension will be 40000. The pay of the employer will be computed on daily
worked hours and the net pay will be shown with the proper messages of gross salary. The pay of the
employer will be 1000 rupees per day if he/she worked for 8 hours and if it works more than 8 hours, then
he will be paid 300 rupees per hour but the extra time can only be utilized at maximum of 3 hours.
#include<iostream>
using namespace std;
int main(){
cout<<"Enter the type of employees: retired and employed\n";
string type ;
cin>>type;
if(type=="retired"){
cout<<"Enter your age: \n";
int age;
cin>>age;
if(age>=60 && age<=70){
cout<<"The pay is: "<<30000 <<endl;
}
else if(age>70){
cout<<"The pay is: "<<40000 <<endl;
}
}
else if(type=="employed"){
cout<<"Enter the number of hours worked\n";
int hour;
cin>>hour;
if(hour>8){
if((hour-8)>3){
cout<<"Invalid hours\n";
}
else{
int pay =1000 + (hour - 8) * 300;
cout<<"The pay is: "<<pay * 30<<endl;
}
}
else {
cout<<"The pay is: "<<1000 * 30<<endl;
}
}
}
Comments
Leave a comment