Question: code in c++ two files 1. .cpp file (Prog05.cpp) and the companion .h file (Employee.h) For this program you will create a binary tree of

code in c++

two files 1. .cpp file (Prog05.cpp) and the companion .h file (Employee.h)

For this program you will create a binary tree of employees. The beginning of the EmployeeInfo class is:

class EmployeeInfo

{

private:

int empID;

string name;

public: ....

Your tree will contain EmployeeInfo objects. You will then need to create four member functions of EmployeeInfo, a constructor, an overloaded < member function, an overloaded == member function, and an overloaded << as a friend function.

The EmployeeInfo class and associated member/friend functions should appear in a file Employee.h

Note that because you are dealing with const objects in genBST.h, you need to declare your member functions as:

operator XX (arguments) const

{ }

You will then create a free function with the following prototype:

void replaceAnEmployee(BST &tree, int EmployeeToBeReplaced, int ReplacementID, string ReplacementName)

This function will delete the employee with ID EmployeeToBeReplaced and then add to the tree the employee with ID ReplacementID, and with name ReplacementName. You need to use the appropriate BST member functions to implement this function.

Your main program will have two functionalities, to search for an employee, and to replace an employee.

(continued on next page)

Your output should look as follows:

Inorder traversal of employee list is:

ID Number: 1017 Name: Debbie Debson

ID Number: 1021 Name: John Robinson

ID Number: 1057 Name: Bill Dithers

ID Number: 1275 Name: George McGovern

ID Number: 1899 Name: Obama Obama

ID Number: 2487 Name: Jenn Reuters

ID Number: 3769 Name: Alfred Goto

ID Number: 4218 Name: Someone Else

Enter an employee number: 1000

That employee was not found.

Do you want to continue? Yes or No

Yes

Enter an employee number: 1021

Employee was found:

ID Number: 1021 Name: John Robinson

Do you want to replace an employee? Yes or No

Yes

Enter Employee ID of existing employee to be replaced:

1899

Enter Employee ID of replacement:

2000

Enter first name of replacement:

Iam

Enter last name of replacement:

Replacement

Inorder traversal of employee list is:

ID Number: 1017 Name: Debbie Debson

ID Number: 1021 Name: John Robinson

ID Number: 1057 Name: Bill Dithers

ID Number: 1275 Name: George McGovern

ID Number: 1899 Name: Obama Obama

ID Number: 2000 Name: Iam Replacement

ID Number: 2487 Name: Jenn Reuters

ID Number: 3769 Name: Alfred Goto

ID Number: 4218 Name: Someone Else

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!