Question: Employee Exercise For this exercise, you will create two files the Employee.h file, which will hold the class and member function definitions, and the empDriver.cpp

Employee Exercise

For this exercise, you will create two files the Employee.h file, which will hold the class and member function definitions, and the empDriver.cpp file, which will be used to implement the Employee objects.

Employee.h

Create a class called Employee that includes the following:

1. Two data members:

- full name

- monthly salary

2.Two constructor that initializes the two data members.

- The first constructor should be a default constructor. It takes no parameters but initializes the name and salary to (space) and 0 respectively.

- The second constructor should take two parameters and should initialize the name and salary using the values in the parameters

3. Accessor and Mutator functions for each member.

Tip: create inline functions for this exercise.

empDriver.cpp

Create a driver program that tests the Employee class.

1. Create two Employee objects. (You may hard code one object to test your 2-paramter constructor. The other object should rely on your default constructor)

2. Prompt the user for input for the object that was not hardcoded. Transfer the values to the private class members by using the mutator functions.

3. Use the accessor functions to retrieve the name and salaries for the employees and calculate the yearly salary. Display the name and yearly salary for the objects.

4. Give your employees a 10% raise! Use the mutator functions to update the value of their monthly salary.

5. Repeat step 3 to show that the raisehas taken effect.

Sample output is shown below:

Enter an employee name: Peter Peterson

Enter the employee's monthly salary: 4000

Here are the employees and their yearly salaries

Nicole Watterson: $42000

Peter Peterson: $48000

Here are the employees and their yearly salaries with a 10% raise

Nicole Watterson: $46200

Peter Peterson: $52800

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!