Question
Instruction :- Write all answers in a .cpp file and upload it using the upload option below this question. Be sure to number your question
Instruction:- Write all answers in a .cpp file and upload it using the upload option below this question. Be sure to number your question properly.
Use the following class definition of Employee and Manager to answer the questions that follow.
class Employee {
public:
Employee(string name, float payRate);
string getName();
float getPayRate();
float pay(float hoursWorked);
protected:
string name;
float payRate;
};
class Manager : public Employee {
public:
Manager(string theName,
float thePayRate,
bool isSalaried);
bool getSalaried() const;
float pay(float hoursWorked) const;
private:
bool salaried;
};
Employees paid by a salary (i.e., those that are salaried) get a fixed amount of money each pay period (e.g., week, 2 weeks, month) regardless of how many hours they work. If the manager is salaried, payRate is the fixed rate for the pay period; otherwise, it represents an hourly rate, just like it does for a regular employee. Note: A manager can be salaried or hourly paid.
A. Write the codes for the constructor of class Employee. (5 Points)
B. Write codes for the constructor of class Manager. (4 Points)
C. Write codes to implement the function pay in class Employee. (4 Points)
Plz Write this in C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started