Description
Your assignment is to create a word search application using the Scanner class and regular expressions.
You program should prompt the user for an input file that will contain the word search puzzle. You program should then present that puzzle to the user and ask which word to search for. Your search should be able to find a word horizontally, vertically, and diagonally both forwards and backwards.
If the file entered by the user is not present, you must inform the user and prompt again. If the user enters “exit” at this prompt, the program should exit with code 1.
After your program displays the puzzle to the user, it should prompt for a word to search, if “exit” is entered, your program should exit with code 2. Otherwise, your program should search for the word and display where it found the word. If the word is not present, it should tell the user.
You can assume that your word search puzzle is n x n.
Your file should be named WordSearch.java.
You may only use basic java types.
Example output:
>$ java WordSearch
Enter puzzle file name:>../../word_search.txt
Can’t find that file! Try Again.
Enter puzzle file name:>../../../word_search.txt
-Puzzle-
thisi
isawo
dfhgs
evens
dfnsd
Which word would you like to find?
even
Searching for even…
Found “even” in row 3: evens
-Puzzle-
thisi
isawo
dfhgs
evens
dfnsd
Which word would you like to find?
icecube
Searching for icecube…
Unable to find icecube
-Puzzle-
thisi
isawo
dfhgs
evens
dfnsd
Which word would you like to find?
exit
Process finished with exit code 2
>$
Grading:
Correctness: You can lose up to 20% if your solution is not correct
Quality: You can lose up to 20% if your solution is poorly designed
Testing: You can lose up to 20% if your solution is not well tested
Explanation: You can lose up to 40% if you cannot explain your solution during the grading session