Question: Anyone can help me how to solve this question please. Assume one-or-more empty lines separate paragraphs in a text file. This homework requires you to

Anyone can help me how to solve this question please.

Assume one-or-more empty lines separate paragraphs in a text file. This homework requires you to develop a Java program that accepts 2 command-line arguments (i.e., arguments to the main method):

  1. The first command-line argument will be the path to the text file to be processed.

  2. The second command-line argument will be a Boolean flag (true or false). If this flag is false then word counts should simply be printed as zero. If this flag is true then word count must be computed and printed.

  3. The program is relatively straightforward. Use Scanner.nextLine() method to read lines from a text file.

Print the first and last line (if different) of a paragraph in a given HTML format. Note that if first and last line is identical (i.e., a paragraph has only 1 line) then print just the first line.

Sample input:

This is the first line of first paragraph This is the second line of first paragraph This is the third line of first paragraph This is the last line of first paragraph

Second para line 1 Second para line 2

A one line third paragraph

This paragraph is going to have 5 lines. Line 1 of 5 This paragraph is going to have 5 lines. Line 2 of 5 This paragraph is going to have 5 lines. Line 3 of 5 This paragraph is going to have 5 lines. Line 4 of 5 This paragraph is going to have 5 lines. Line 5 of 5

This is the last, 1 line paragraph in this file.

Sample output:

Anyone can help me how to solve this question please. Assume one-or-more

iava Homeworkl base case.txt false

First and last lineWord counts/tr> trxtd> Second para 1ine 1 Second para line 2xtd>Words: 0 English words: A one line third paragraph x/tdXtr> line of first paragraph Words0 English words: 0 0 trxtd>This paragraph is going to have 5 lines. Line 1 of 5 This paragraph is going to have 5 lines. Line 5 of 5Words: 0 English words: 0xtr> xtd>This is the last, 1 line paragraph in this file.Words: 0 English words 0 /table>
This is the first line of first paragraph This is the last
Words: 0 English words 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!