[solved]-Given String Name Three Integers Id Hr Hw Create Class Hourlyemployee Following Characteri Q39043198
Given a string NAME and three integers ID, HR, HW. Create a Class Hourly Employee with following characteristics
- Extend an Employee class.
- Private member variable hourlyRate andhoursWorked as an integer.
- Parameterized Constructor with parameters in the order of NAME,ID, HR (for hourlyRate) and HW (for hoursWorked).
- Parameterized Constructor should call a super class constructorwith NAME and ID. Also, initialize hourlyRate withHR and hoursWorked with HW.
- The public function getGrosspay without anyparameter and return gross pay amount of type integer.
Grosspay = (hourlyRate * hoursWorked )
Input
Alex
101
100
5
Where,
- First line represents NAME.
- Second line represents ID.
- Third line represents hourly rate HR.
- Forth line represents hours worked HW.
Output
101
Alex
500
Where,
- The first line represents an ID.
- The second line represents a NAME.
- The third line represents Gross Pay.
Not sure where to begin. Please use code template below:
class Person {
private:
string name;
public:
Person(string s){
this -> setName(s);
}
void setName(string name) {
this -> name = name;
}
string getName() {
return this -> name;
}
};
// Derived class
class Employee: public Person {
private:
int id;
public:
Employee(string sname, int id): Person(sname)
{
this -> setId(id);
}
void setId(int id) {
this -> id = id;
}
int getId() {
return this -> id;
}
};
like cin/cout.
//write your code here
int main() {
string NAME ;
cin >> NAME;
int ID;
int HR;
int HW;
cin >> ID;
cin >> HR;
cin >> HW;
HourlyEmployee hourlyEmployee(NAME, ID, HR, HW);
cout << hourlyEmployee.getId() << endl;
cout << hourlyEmployee.getName() << endl;
cout << hourlyEmployee.getGrosspay();
return 0;
}
Expert Answer
Answer to Given a string NAME and three integers ID, HR, HW. Create a Class Hourly Employee with following characteristics Extend a… . . .
OR

