Follow all code styling and submission instructions as outlined for previous labs. Declare and implement a BSTNode ADT with a data attribute and two pointer attributes, one for the left child and the...

1 answer below »

Follow all code styling and submission instructions as outlined for previous labs.



  • 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 have at least 10 Dollar objects created from data specified in your main to seed the tree.

  • Read the data of your main to create your Dollar database using the BST.

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

  • Perform adequate 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 output file) to indicate which data items were ignored.

  • Provide interactivity for the user to add/search/delete nodes from the console after the data has been seeded into the application, including data validation.

  • 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 ADT, Dollar and main code files, screenshots of console window and your output files only.


  • demonstrate use of your Lab 4 queue without any modifications for the tree traversals





Answered Same DayNov 23, 2021

Answer To: Follow all code styling and submission instructions as outlined for previous labs. Declare and...

Arun Shankar answered on Nov 28 2021
159 Votes
public class BST
{
    // Define a BSTNode class to represent
    // a node of the binary search tree.

    class BSTNode
    {
        Dollar_Currency data;
        BSTNode left;
        BSTNode right;
        
        // Constructor
        BSTNode(Dollar_Currency data)
        {
            this.data = data;
            this.left = this.right = null;
        }
        
        // Getters and setters for the class
        public BSTNode leftChild() {
            return...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here