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):
-
The first command-line argument will be the path to the text file to be processed.
-
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.
-
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:
iava Homeworkl base case.txt falseThis is the first line of first paragraph This is the last |
Words: 0 English words 0 | Xtr> line of first paragraph Words0 English words: 0 0
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