Question: C++ Define and implement the class Employee with the following requirements: private data members string type name double type hourlyRate public member functions default constructor

C++

Define and implement the class Employee with the following requirements:

private data members

string type name

double type hourlyRate

public member functions

default constructor that sets the data member name to blank and hourlyRate to zero

A constructor with parameters to initialize the private data members

Set and get methods for all private data members

A constant method weeklyPay() that receives a parameter representing the number of hours the employee worked per week. This method calculates and returns the weekly pay for the employee. Hours worked over 40 are paid at 1.5 times the regular hourlyRate.

A constant method print() that displays the value of the private data members.

Then:

Define two Employee objects one using the default constructor and the second using the constructor with parameter.

Call the print() method on both objects.

Call the weeklyPay on both objects using 39 and 45 as the argument for the number of hours worked. Display the weekly pay.

For this problem you need the Employee class again. Write another main function to answer the following parts. Only submit the main function for this problem. Your code will be tested.

Create an Employee object using the constructor with parameter.

Declare an Employee pointer and make it point to the Employee object you created in the previous part.

Use the pointer to call the print() method of the object.

Dynamically create an Employee object and make the pointer point to this newly created dynamic object.

Use the pointer to call the print() method of this new object.

Design a class named Faculty that extends the Employee class in the problem 1 (inherits from this class). The class contains the following:

private data members

string type degree

bool type isTeachingThisMonth

string type lastCourseTaughtTitle

4.public member functions

default constructor that sets the data member degree to blank and isTeachingThisMonth to false and lastCourseTaughtTitle to blank .

A constructor with parameters to initialize the private data members.

Set and get methods for all private data members

A constant method printFaculty() that displays the value of the private data members.

Then:

Create a Faculty object named fac1 using the default constructor.

Create a Faculty object named fac2 using the constructor with parameter using the following info:

name = John | hourlyRate = 30 | Degree = MSc | isTeachingThisMonth = true | lastCourseTaughtTitle = C++

Set (change) the Degree of the faculty object fac2 to PhD

Call the printFaculty () method on fac2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!