Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

=+(30.29) p[ x : cos Ax u] =1 -; arccos u, -1

Answered: 1 week ago