How can I have my program read a file from the console? the input in the command line for example is: java Test03 -i java Test03 -s The program will read the file and index it as in the previous option (-i), but will then prompt the user to enter a word, instructing the user that entering an empty line (no printable characters) will cause the program to exit. The program will then find the word in the tree, outputting the words (but not the indices) of each node it searches to demonstrate that it is performing a proper search and demonstrating that your binary search tree is properly structured. If it finds the target word, it will then output (on a separate line) the word's entry as specified in the previous option (-i). (Hint: a method to output a node's data into a String and then print that string using println().) The program will then prompt the user to enter a word (as before), continuing in the loop until the user exits the program.
How can I have my program read a file from the console?
the input in the command line for example is:
java Test03 -i <filename>
java Test03 -s <filename>
The program will read the file and index it as in the previous option (-i), but will then prompt the user to enter a word, instructing the user that entering an empty line (no printable characters) will cause the program to exit.
The program will then find the word in the tree, outputting the words (but not the indices) of each node it searches to demonstrate that it is performing a proper search and demonstrating that your binary search tree is properly structured.
If it finds the target word, it will then output (on a separate line) the word's entry as specified in the previous option (-i). (Hint: a method to output a node's data into a String and then print that string using println().)
The program will then prompt the user to enter a word (as before), continuing in the loop until the user exits the program.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images