Question: In C + + please create a class for EmployeeInfo that contains: Employee ID Number int Employee Name string Implement a binary search tree whose

In C++ please create a class for EmployeeInfo that contains:
Employee ID Number int
Employee Name string
Implement a binary search tree whose nodes hold an instance of your EmployeeInfo class. The nodes should be sorted on the Employee ID number. You will have a binary search tree class header and implementation file.
You can write your main to use the following information to test your tree:
Employee ID Number Employee Name
6702 James B W Bevis
1255 Romney Wordsworth
1071 Revis Jacara
2390 Clegg Forbes
1558 Kalin Tros
7406 Archibald Beechcroft
7562 Penthor Mul
3004 Bartlet Finchley
4922 Latham Bine
8483 Jeff Myrtlebank
Your main will have one binary search tree object and all of the operations on the binary search tree will be class methods. You can use the code from the book for your binary search tree class. You will also offer the following options to the user:
Search for an ID
Display the tree
Add a new employee
Remove an employee
You will submit the following:
All of program source and header files compressed into a zip file.
BinaryNode.cpp :
/** @file BinaryNode.cpp */
#include "BinaryNode.h"
#include
template
BinaryNode::BinaryNode()
: item(nullptr), leftChildPtr(nullptr), rightChildPtr(nullptr)
{}// end default constructor
template
BinaryNode::BinaryNode(const ItemType& anItem)
: item(anItem), leftChildPtr(nullptr), rightChildPtr(nullptr)
{}// end constructor
template
BinaryNode::BinaryNode(const ItemType& anItem,
std::shared_ptr> leftPtr,
std::shared_ptr> rightPtr)
: item(anItem), leftChildPtr(leftPtr), rightChildPtr(rightPtr)
{}// end constructor
template
void BinaryNode::setItem(const ItemType& anItem)
{
item = anItem;
}// end setItem
template
ItemType BinaryNode::getItem() const
{
return item;
}// end getItem
template
bool BinaryNode::isLeaf() const
{
return ((leftChildPtr == nullptr) && (rightChildPtr == nullptr));
}
template
void BinaryNode::setLeftChildPtr(std::shared_ptr> leftPtr)
{
leftChildPtr = leftPtr;
}// end setLeftChildPtr
template
void BinaryNode::setRightChildPtr(std::shared_ptr> rightPtr)
{
rightChildPtr = rightPtr;
}// end setRightChildPtr
template
auto BinaryNode::getLeftChildPtr() const
{
return leftChildPtr;
}// end getLeftChildPtr
template
auto BinaryNode::getRightChildPtr() const
{
return rightChildPtr;
}// end getRightChildPtr
BinaryNode.h :
/** A class of nodes for a link-based binary tree.
Listing 16-2.
@file BinaryNode.h */
#ifndef BINARY_NODE_
#define BINARY_NODE_
#include
template
class BinaryNode
{
private:
ItemType item; // Data portion
std::shared_ptr> leftChildPtr; // Pointer to left child
std::shared_ptr> rightChildPtr; // Pointer to right child
public:
BinaryNode();
BinaryNode(const ItemType& anItem);
BinaryNode(const ItemType& anItem,
std::shared_ptr> leftPtr,
std::shared_ptr> rightPtr);
void setItem(const ItemType& anItem);
ItemType getItem() const;
bool isLeaf() const;
auto getLeftChildPtr() const;
auto getRightChildPtr() const;
void setLeftChildPtr(std::shared_ptr> leftPtr);
void setRightChildPtr(std::shared_ptr> rightPtr);
}; // end BinaryNode
#include "BinaryNode.cpp"
#endif
BinaryNodeTree.cpp :
/** @file BinaryNodeTree.cpp */
#include "BinaryNodeTree.h"
#include "BinaryNode.h"
#include
//////////////////////////////////////////////////////////////
// Protected Utility Methods Section
//////////////////////////////////////////////////////////////
template
int BinaryNodeTree::getHeightHelper(std::shared_ptr> subTreePtr) const
{
if (subTreePtr == nullptr)
return 0;
else
return 1+ std::max(getHeightHelper(subTreePtr->getLeftChildPtr()),
getHeightHelper(subTreePtr->getRightChildPtr()));
}// end getHeightHelper
template
int BinaryNodeTree::getNumberOfNodesHelper(std::shared_ptr> subTreePtr) const
{
if (subTreePtr == nullptr)
return 0;
else
return 1+ getNumberOfNodesHelper(subTreePtr->getLeftChildPtr())
+ getNumberOfNodesHelper(s

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!