In JAVA
I have to connect it with the file "dataSourceforBST.txt"
Help me!
Option 3 - Binary Search Tree - Book Inventory System Binary Search Tree Specification: • Node<T> o Properties -data:T -left:Node<T> -right:Node<T> o Methods Constructors Write whatever constructors you need • +getData(): T ▪ +setData(int):void +getLeft():Node<T> . +setLeft (Node<T>):void +getRight():Node<T> • +setRight (Node<T>):void BinarySearchTree<T> o Properties -root:Node<T> -count: int o Methods Constructor empty tree ▪ +insert(value:T):Node<T> create a node containing T data and add it to the tree (REMEMBER: NO DUPLICATES) +remove(value:T):void • find value and remove it +exits (value:T): boolean +find(value:T):Node<T> +toArray(): T[] • Collapse the BST into an array of the data • Pre-order traversal so you can recreate the tree from the array +empty():void deletes all the nodes in the tree +count(): int More methods private or public should be created as needed to facilitate the functionality of the Interface methods. If you feel your tree needs more functionality, feel free to create it.
Book Inventory You will design a book inventory database system. The goal here is to read in an inventory list from a file each entry includes an identification number, title, quantity and comments. • BookEntry o Properties O . ▪-id:int • -title:string • -quantity: int . -comments:string Methods . constructors ▪ appropriate getters/setters • +toString(): string ▪ +fileString(): string This method will make file output easier • Should generate a string like the entries in the sample file NOTE: this should implement the comparable interface! • Comparison should be on the id number Then allow the user to work with their inventory. A user should be able to do the following: Read inventory from a Text File (a tab separated sample will be provided) Retrieve a book by ID number After retrieving the book allow the following: O The user should be able to edit the Title, Quantity and/or Comments (replace old information with new) o Delete the entry Enter a new book into the inventory Save the changes to a new file (I recommend the same format as the input) o toArray() might help • Clear the current working database (without saving, warn the user before proceeding) Extra Credit +5 Create a depth first search or breadth first search that allows the user by title. Note: this will not be part of your BST class as the BST doesn't know what data is being stored in it. You might need to add some functionality though like getRoot():Node<T> so you an write the algorithm into your Book Inventory class.
In JAVA I have to connect it with the file "dataSourceforBST.txt" Help me!
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am