the next part of the question:-
1 - 'getInfo()' which takes the salary, number of hours of work per day of employee as parameters
2 - 'AddSal()' which adds $10 to the salary of the employee if it is less than $500.
3 - 'AddWork()' which adds $5 to the salary of the employee if the number of hours of work per day is more than 6 hours.
here the code begins
-<
include
using namespace std;
class Employee{
public:
int salary,hours;
int getinfo(int s,int h){
salary=s;
hours=h;
}
int addsal(){
if (salary<500){
return salary+10;
}
else if (salary>500){
return salary;
}
}
int addwork(){
if ( hours>6){
cout<<"salary1 is : "<< addsal()+5;
}
else{
cout<<"salary is : "<<addsal();
}
}
};
int main()
{
Employee obj;
int salary1,hours1;
cout<<"The salary1 of the employee : ";
cin>>salary1;
cout<<"The working hours1 of the employee : ";
cin>>hours1;
obj.getinfo(salary1,hours1);
obj.addsal();
obj.addwork();
}
Top comments (0)