#Sales Offer!| Get upto 25% Off:

Class Homework assignment 4 

Write a Java program to achieve the following: – First, create an algorithm to solve this problem. 

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 search

word. 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.

Example of input.txt

In-class assignment 1

Create a java program to achieve the following:

Ask the user for the number of integers to randomly generate.

Create an integer array of the appropriate size and insert the randomly generated integers (in the range 1 –

100) into the array.

Ask the user for a search value (integer), then check to see if the array contains this value and display a

message to indicate if found or not.

Finally, display the contents of the array, the sum of the numbers in the array, the smallest value and the 

largest value in the array.

[email protected] – the 

Output.txt file

Ask the user for the number of integers to randomly generate.  

Create an integer array of the appropriate size and insert the randomly generated integers (in the range 1 – 

100) into the array. 

Ask the user for a search value (integer), then check to see if the array contains this value and display a 

Finally, display the contents of the array, the sum of the numbers in the array, the smallest value and the

Screen output

In-class assignment 1

[sw found] Create a java program to achieve the following:

[sw found] Ask the user for the number of integers to randomly generate.

[sw found] Create an integer array of the appropriate size and insert the randomly generated integers

[sw found] (in the range 1 – 100) into the array.

[sw found] Ask the user for a search value (integer), then check to see if the array contains this value

and display a message to indicate if found or not.

[sw found] Finally, display the contents of the array, the sum of the numbers in the array, the smallest

value and the largest value in the array.

[email protected]Extra Credit 

 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)

Extra-extra credit 

 Include the number of times the search word appears in the line

For example, line 5 would show as:

[the found (4) times] Create an integer array of the appropriate size and insert the randomly

generated integers (in the range 1 – 100) into the array.

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!