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.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

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.

Expert Solution
Step 1

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

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr