Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java Program to ask the user for a search-word to be found in the text of an input file. Read each line of

Write a Java Program to ask the user for a search-word to be found in the text of an input file. Read each line of the input.txt file (supplied by you), and search each line to see if it contains the searchword. If the search-word is found within the line of text, then output that line to an output.txt file, and display the line on the screen with an indication that the line contains the search-word (prefix the line with [sw found]). Lines not containing the sw should just be written as is to the screen.

You should: ==> Request the input/output file names from the user ==> Place the search word inside the marker. For example, if the search word was the, then the marker would be [the found] ==> Modify the file output to append to the existing file rather than overwriting the data ==> Make the search case-insensitive (the The THE) ==> Include the number of times the search word appears in the line

Example Input.txt You will find the word in your document if you better understand the knowledge of everything. Programming is a good thing to learn because it tells us that what to do on time and what to do not on the time if you think you are good programmer then you should build complex programs to learn more about programming and implement in your daily life. you are the brilliant man in the word. Stay Blessed.

If Search word is the then Output.txt file will be You will find the word in your document if you better understand the knowledge of everything. Programming is a good thing to learn because it tells us that what to do on time and what to do not on the time if you think you are good programmer then you should build you are the brilliant man in the word.

Screen Output will be [the found (2) times] You will find the word in your document if you better understand the knowledge of everything. [the found (1) times]Programming is a good thing to learn because it tells us that what to do on time and what to do not on the time if you think you are good programmer then you should build complex programs to learn more about programming and implement in your daily life. [the found (2) times] you are the brilliant man in the word. Stay Blessed.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How are control procedures with no documentary evidence tested?

Answered: 1 week ago