Question: Write and test a Java program that will provide a count of the number of words, number of lines, and/or number of characters according to

 Write and test a Java program that will provide a count

of the number of words, number of lines, and/or number of characters

Write and test a Java program that will provide a count of the number of words, number of lines, and/or number of characters according to an option specified on command line along with the absolute path or relative path to the file upon which the program will operate. The following character combinations are to represent appropriate options: -W The option -w is used to provide a count of the number of words in a file and the file name. The option -l is used to provide a count of the number of lines in the file and the file name. The option -c is used to provide a count of the number characters in the file and the file name. If the path to the file is provided without any of the above options, then the file name and a count of the number words, lines, and characters is written to the standard output device. Words are defined as a sequence of characters delimited by a space. A line is identified by the newline (" ") character. A character is valid utf-8 sequence of bytes. Examples of what the output may look like (actual numbers may be different): The program named "data" contains Amy looked at her watch. He was late. The sun was setting but Jake didn't care. 1 Note that the space character between the words and the newline (" ") character are included in the count of characters (1) Word count for a file named data C:\> Java WordCount -w path\to\data File: data Word count: 16 (2) Line count for a flle named data $ java WordCount -1 -/path/to/data Flle: data Line count: 1 (3) Character count for a file named data File: data Character count: 80 (4) Line, word, and character count for a file named data $ java WordCount /path/to/data File: data Line count: 1 Word count: 16 Character count: 80 Your solution must include at least one additional method whose purpose is to count the number of words, number of lines, and number of characters in the file. In other words, leader comments public class NameOfClass public static void main(String[] args) { Don't forget to document your code puble stam lype void method that Does TheCounting

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!