Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / This project takes bases on a possible real-world example of reading in information and constructing an organized representation of it in a tree

This project takes bases on a possible real-world example of reading in information and constructing an organized representation of it in a tree

Computer Science

This project takes bases on a possible real-world example of reading in information and constructing an organized representation of it in a tree. Your objective is to implement all code from all header files. Feel free to use all your resources. The project will test your knowledge of working and implementing classes, overloaded operators, ABC’s, templates, inheritance, and tree structures (AVL). Objective The objective of the program is to create a tree structure from the items read from the file PersonBankInfo.txt. Each row from the file will be stored in a class called CPersonInfo that holds two strings for a first and last name, an int for age, and two doubles for the amount of their checking and savings account. StarterKit To help you and create the tree structure, I have included a starter kit with all the header files and main.cpp. You’ll find the starter kit CBSTStarterKit.tar.gz in your Project_CBST folder. You’ll have a total of 13 files: main.cpp, CBinaryNode.h, CBinaryNode.tpp, CBinaryNodeTree.h, CBinaryNodeTree.tpp, CBinaryTreeInterface.h, CBST.h, CBST.tpp, CPersonInfo.h, CPersonInfo.cpp PersonBankInfo.txt, PrecondViolatedExcept, and SampleExecutable. As a note, all .tpp files are template implementation files and we only compile .cpp files (in this case only main.cpp, CPerson.cpp, and PrecondViolatedExcept.cpp). I will also include a hierarchy of the flow of implementation below. Class Headers / Main Function Description The main function is your goal to make it work and feel free to add more code to test more features of the AVL tree. Below is the idea of each header file. For more detailed information on each class and function, please reference the starter kit. CBinaryTreeInterface is an ABC’s header file that sets up the structure of a tree (doesn't have to be a Binary Search Tree). CBinaryNode sets up each node for the tree. This is very similar to CNode in your HW assignments when we worked with CLinkedList. However, this one is templated. CBinaryNodeTree is a subclass from CBinaryTreeInterface and uses CBinaryNode as a private data member. The first thing that you will notice is that CBinaryNodeTree is also an ABC because some functions are left as pure virtual functions (particularly the functions used to keep the tree balanced). The last thing is we include the PrecondViolatedExcept header file where we can use the class to throw exceptions. CBST inherits from CBinaryNodeTree to further work with the tree structure. This time, CBST is no longer an ABC as all functions should be implemented by now, and some new ones introduced. The ordering of the BST is by the age of each person. Granted, we can change the order in the future to something else, like their savings or checking numbers or by their names. main.cpp allocates a CBST object to construct the tree structure. Furthermore, main uses the class CPersonInfo to store the information of each person in the file PersonBankInfo.txt. Balancing Your BST using AVL Something to note is how are we going to balance the tree? First, I recommend you leave this part at the end and focus on the rest of your program. To balance the tree as an AVL, you can refer to pg. 593 from our book (7thedition) and/or to the class lecture notes. Notes To read more information about trees, I recommend reading Chapters 15 and 16. I recommend that you program each phase one at a time to make sure you have a working project and finally connect it all. I would encourage you to build many side programs to ensure each part of your code is doing exactly what you're programming it to do. Use lots of cout statements to help you debug and in combination with using GDB. What helped me the most is by drawing pictures of the memory and running the code by hand.

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions