Problem

Write a method called inputStats that accepts a Scanner representing an input file and rep...

Write a method called inputStats that accepts a Scanner representing an input file and reports the number of lines, the longest line, the number of tokens on each line, and the length of the longest token on each line. If the file contains the following text:

Beware the Jabberwock, my son,the jaws that bite, the claws that catch,Beware the JubJub bird and shunthe frumious bandersnatch.

For the input above, your method should produce the following output:

Line 1 has 5 tokens (longest = 11)Line 2 has 8 tokens (longest = 6)Line 3 has 6 tokens (longest = 6)Line 4 has 3 tokens (longest = 13)Longest line: the jaws that bite, the claws that catch,

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT