Question: java program The purpose of this program is to read a text file, read a string from the user, search the text file for all
java program The purpose of this program is to read a text file, read a string from the user, search the text file for all occurrences of the string and print the string along with the number of occurrences found. The program will
a. Ask the user for the text file name b. Find the text file and open it
c. Ask the user for the search-string (16 characters or fewer)
d. Read the input file, searching for the search-string while reading (file will be longer than 1000 words)
e. Count occurrences of the text string
f. Close the text file
g. Print the search-string and the number of occurrences
Ex: xYz was found 11 times in data.txt
Remember to test thoroughly, including - No matches - One match - Many matches The matching must be case-sensitive. Remember that a text string can span two or more words.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
