In this lab, you will write a program which builds a tree “dictionary” of words that were found in a piece of text and keep track of how many times each of the words occurred.
Basic Requirements:
1. You must have a menu in your main method with the following options:
· Reset the tree to empty
· Read a string of text from the keyboard and add to the dictionary (**optional)
· Read text from a file add to the dictionary (**optional)
· Search for a word and show how many times it occurred in the text
· Display the number of nodes in the dictionary
· Exit
** you must implement either from file or from keyboard – bonus marks if you do both!!
2. You must use the collection class TreeMap to implement this assignment. A description of the methods available in that class can be found in the Java documentation. Efficient use of the class will factor in the assignment marking.
3. Hint: you should put all the “words” that you read into either uppercase or lowercase to make sure that the words “there” and “There” count as the same. You should also remove non-alphabetic characters using the String method word.replaceAll(“^\\s”,””); which replaces basically all non-characters with nothing.
4. I have given you a .txt file of the book Oliver Twist called oliver.txt. I have used that in my sample output.