Starting from:
$35

$29

Programming Project #5 Solution




IntTreeBag Class




You are to code the Bag class as specified in your text at the end of Chapter 10 . You are also to add a ‘print()’ method to the Bag, which outputs the bag contents to standard output (the screen). The print method should use an inorder traversal.




The class binary_tree_node<T class is provided on the website for you to download in files bintree.h and bintree.template. The declaration for the Bag class is provided in the file bag6.h (recall that most compilers expect a template class to be included in one .h file) Remember that this class is a binary search tree, in which data is placed based on order.




 

The Application

 

You are to write an application which creates an Bag object, and allows the user to perform any of the following operations until he/she wishes to exit:




Insert an int value to the bag (the user provides the value to be added)
Remove an int value from the bag ( the user provides the value to be removed, and is informed if the removal was successful)
Output the number of ints stored in the bag
Add the contents of one bag to another ( the user should be prompted for the values to be included in the second bag)
Combine the bag with another producing a third bag (the user should be prompted for the values to be included in the second bag)
Accept a value from the user, and output the number of occurrences of this value in the bag
Output the bag contents
 

Submit all .h and .cpp files used in your project. You do not need to zip the files, I actually prefer them as separate attachments.



More products