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:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Potential Method of Analysis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education