Need help with these assignments, I use C++. Thank you. Lab 4: Declare and implement a BSTNode ADT with a data attribute and two pointer attributes, one for the left child and the other for the right...


Need help with these assignments, I use C++. Thank you.


Lab 4:



  • Declare and implement a BSTNode ADT with a data attribute and two pointer attributes, one for the left child and the other for the right child. Implement the usual getters/setters for these attributes.

  • Declare and implement a BST as a link-based ADT whose data will be Dollar objects - the data will be inserted based on the actual money value of your Dollar objects as a combination of the whole value and fractional value attributes.

  • For the BST, implement the four traversal methods as well as methods for the usual search, insert, delete, print, count, isEmpty, empty operations and any other needed.

  • Your pgm will use the following 20 Dollar objects to be created in the exact order in your main to seed the tree:



      1. $57.12

      2. $23.44

      3. $87.43

      4. $68.99

      5. $111.22

      6. $44.55

      7. $77.77

      8. $18.36

      9. $543.21

      10. $20.21

      11. $345.67

      12. $36.18

      13. $48.48

      14. $101.00

      15. $11.00

      16. $21.00

      17. $51.00

      18. $1.00

      19. $251.00

      20. $151.00





  • Also, create an output file to write program output as specified in one or more instructions below.

  • After seeding the data, perform your traversal operations in the specific sequence of breadth-first, in-order, pre-order, post-order, ensuring that output is written out to both screen and file concurrently.

  • Then provide interactivity for the user to add/search/delete nodes from the console after the data has been seeded into the application.

  • Perform adequate input data validation when reading data from the user into the tree - if any data item is invalid, ignore the data item and continue to next item but print a message to output (both screen and same output file) to indicate which data items were ignored.

  • Also, provide the user the option to print output of traversals or exit the program. Once the user selects the option to print data or exits the program, the data in the BST should be printed out to both screen and output file in all four traversal methods in the specific sequence of breadth-first, in-order, pre-order, post-order.

  • For submission - upload your BST, Dollar/USD and main code files, screenshots of console window and your output files only.



Lab 6:



  • Derive a MinHeap class from the BST class of your Lab 4 code.

  • Define/Override only the Search/Insert/Delete methods in the new class.

  • Write a new main for this lab which:

    • Will only be a test program for the MinHeap.

    • Declares and creates a MinHeap object as necessary.

    • Declares and creates the Dollar objects as necessary.

    • Inserts the 20 Dollar objects specified in Lab 4 in the same order.

    • Performs all 4 traversals after the inserting the 10th and the last objects - in total there will be 8 outputs which should be clearly demarcated.

    • No user input is necessary, no data validation is necessary.



  • For submission - upload all class files from Lab 4 as necessary as well as your new MinHeap class and the main. Remember to also include adequate number of screenshots of the program execution.


Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here