2) Consider the code below: Employee class: class Employee { public: Employee(st
ID: 3703803 • Letter: 2
Question
2) Consider the code below: Employee class: class Employee { public: Employee(string theName, float thePayRate); protected: string getName0 const; float getPayRate0 const; float pay(float hours Worked) const; private: string name float payRate; Definitions for some of the methods follow: Employee::Employee(string theName, float thePayRate) name theName; payRate -thePayRate; float Employee::pay(float hours Worked) const return hours Worked * payRate; Manager Class #include "employee"h" class Manager : public Employee public: Manager(string theName, float thePayRate, bool isSalaried); protected: bool getSalaried0 const; float pay(float hours Worked) const; private: bool salaried;Explanation / Answer
A) Output:
Pay1000Pay1200
?Pay1000 is for Employee John Burke (25.0*40) and Pay1200 is for Manager 'Jan Kovacs' as salaried = true, so it will return payRate.
B) Output:
Pay1000Pay48000
For Manager ,48000(40*1200) will be displayed
C)
Employee::Pay()
printPay() is declared in Employee class . So Pay() function of Employee class will be called from printPay()
Do ask if any doubt. Please upvote.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.