Question: I need help writing this method in Java Write a method that reads a text file and, for each line, prints out the number of

I need help writing this method in Java

Write a method that reads a text file and, for each line, prints out the number of words in the line. Try it on the file story.txt.

This is the story.txt file Flowers for Pachyderm, by Mark Strand

As Franz Kafka awoke one morning from uneasy dreams, he found himself

transformed into a raging bull elephant. He charged around his room with

his trunk sticking straight up making loud trumpeting noises. The picture

of the lady in furs came crashing down, the vase of anemones tipped over.

Suddenly afraid that his family might discover him, Franz stuck his

enormous head out of the window overlooking the courtyard. But it was

too late. His parents and sisters had already been awakened by the racket,

and rushed into his room.

All of them gasped simultaneously as they stared

at the great bulk of Franz's rump. Then Franz pulled his head and

turned toward them, looking sheepish. Finally, after an awkward couple

of minutes in which no one spoke, Franz's mother went over and rested her

cheek against his trunk and said, Are you ill, dear? Franz let loose

a bloodcurdling blast, and his mother slipped to the floor. Franz's

father was about to help her up but noticed the anemones tipped over

on the table. He picked them up and threw them out the window,

saying With Franz like this, who needs anemones?

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!