Question: In header file (.h) and c++ file format (.cpp). A local company has asked you to write a program which creates an Employee class, a

In header file (.h) and c++ file format (.cpp).

A local company has asked you to write a program which creates an Employee class, a vector of Employee class objects, and fills the objects with employee data, creating a "database" of employee information. The program allows the user to repeatedly search for an employee in the vector by entering the employee's ID number and if found, display the employee's data.

The Employee_C class should have the following data and in header file format:

-employee full name

-employee ID number (int of 6 digits)

-employee salary

-employee gender (char)

-static variable to hold the total of all employees' salaries

Also create the appropriate constructors and getter and setter member functions for the class variables (hint: an employee's salary should be set, not accumulated; and before a salary is set and added to the static variable, the prior salary should be removed from the static variable).

In main, declare two vectors: one for Employee_C class objects, and one for ID numbers (int).

The program will have three functions:

1) Fill_Vector: have the user repeatedly enter employees' data into Employee objects (unknown number of employees), and place the objects into the Employee vector (hint: fill an object, then place it into the vector).

2) Extract_ID: retrieve the employees' IDs from the Employee vector and place them into the ID vector, i. e., create a vector of employee IDs.

3) Find_Employee: in main the user will repeatedly enter employee IDs and call this function, which will search the ID vector with the entered ID (must use STL algorithm "binary_search") and return either true or false via the function's return type.

Then in main: if the entered ID was found display the employee's data (from the employee vector) plus the total of all employee salaries (using the static variable), or if not found display an error message along with the erroneous ID number.

Enter the following data (full name, ID, salary, gender):

-Joe Jones, 123456, $60,000, M

-Jill James, 987654, $65,000, F

-Leonardo DeApe, 567890, $20,000, M

Then have the user enter the following IDs to search for an employee:

-987654

-123456

-135790 (should produce an error)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To develop the program as described we will need to create a header file for the EmployeeC class implement this class in a corresponding cpp file and write a main function in another cpp file to handl... View full answer

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!