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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started