Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In header file and cpp format A local company has asked you to write a program which creates an Employee class, a vector of Employee

In header file and cpp format

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:

-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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions