Answer:
see explaination
Explanation:
#include <iostream>
#include <string>
using namespace std;
class Employee
{
string name;
int salary;
public: Employee()
{
}
Employee(string name, int salary)
{
this->name=name;
this->salary=salary;
}
void setName(string name)
{
this->name=name;
}
void setSalary(int sal)
{
this->salary=sal;
}
string getName()
{
return name;
}
int getSalary()
{
return salary;
}
void raiseSalary(int percentage)
{
if(percentage<0)
{
cout<<"Invalid percentage";
}
else
{
salary=salary+((float)percentage/100)*salary;
}
}
};
int main()
{
int percentage;
Employee e1("Satur",1000);
cout<<"Employee details are:";
cout<<e1.getName();
cout<<e1.getSalary();
cout<<"Enter the percentage raise";
cin>>percentage;
e1.raiseSalary(percentage);
cout<<"Raise in salary:";
cout<<e1.getSalary();
return 0;
}