Question: FOR C++; I'm using Visual Studio 2017 as IDE. Very important that program contains high-level validation for numeric input (use a while loop and allow

FOR C++; I'm using Visual Studio 2017 as IDE. Very important that program contains high-level validation for numeric input (use a while loop and allow use to re-enter the data). PLEASE ATTACH .cpp AND .h FILES.

Functional Requirements: A looping, menu-driven program that allows the user to create a binary tree and to display data about the tree.

Programming Requirements:

Using the IntBinaryTree class from Chapter 21 as the starting point, add the following member functions:

Leaf Counter (which counts and returns the number of leaf nodes in the tree)

Tree Height (which counts and returns the height of the tree - the height is the number of levels it contains.

Tree Width (which counts and returns the width of the tree - the width is the largest number of nodes in the same level.)

Write a menu-driven program that will allow the user to:

1. Insert numbers

2. Display the tree (in order)

3. Display Leaf Count

4. Display Tree Height

5. Display Tree Width

6. Exit

Your program should contain high-level validation for numeric input (use a while loop and allow use to re-enter the data).

----------------

Test your program as follows:

Insert the following numbers (one at a time through menu option 1): 10, 87, 9, 55, 13, 40, 22,1,0,77, 0, 4, 55, 33, 22

Display the tree

Display the leaf count

Display the tree height

Display the tree width CONTENT OF IntBinaryTree class: FOR C++; I'm using Visual Studio 2017 as IDE. Very important that

Contents of IntBinaryTree.h 1 I Specification file for the IntBinaryTree class 2 ?ifndef INTBINARYTREEH ?define INTBINARYTREE H 5 class IntBinaryTree 7 private: struct TreeNode 9 10 int value; TreeNode left: I1 Pointer to left child node TreeNode right; II Pointer to right child node // The value in the node 12 13 14 15 16 17 18 19 20 21 TreeNode root; / Pointer to the root node Private member functions void insert (TreeNode *&, TreeNode) void destroysubTree void deleteNode (int, TreeNode*) void makeDeletion (TreeNode ) void displayInorder (TreeNode) const; void displayPreorder (TreeNode) const; void displayPostorder (TreeNode const (TreeNode 23 24 25 26 public: 27 28 29 30 31 32 /I Constructor IntBinaryTree() root nullptr; / Destructor -IntBinaryTree() destroysubTree (root): 34 35 36 37 38 39 40 41 42 43 / Binary tree operations void insertNode (int) bool searchNode(int); void remove (int); void displayInorder) const displayInorder (root); h void displayPreorder) const displayPreorder (root);h 45 46 47 48 49 #endif void displayPostorder) const displayPostorder (root)

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!