Write 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 wordsin a file and the file name. -l The option -l is used to provide a count of the number of lines in the file and the file name. -c 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. 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.
Write a Java
The following character combinations are to represent appropriate options:-w The option -w is used to provide a count of the number of wordsin a file and the file name.
-l The option -l is used to provide a count of the number of lines in the file and the file name.
-c 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.
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.
Required:
Write 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 the command line along with the absolute path or relative path to the file upon which the program will operate.
all the code with screenshot has been provided in the next steps.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images