Question: words are separated by spaces, and a sentence ends when a word ends in a period. Start small and just print the first word. Then

words are separated by spaces, and a sentence ends when a word ends in a period. Start small and just print the first word. Then print the first two words. Then print all words in the first sentence. Then print the number of words in the first sentence. Then print the number of words in the first two sentences. Then print the average number of words in the first two sentences. At this time, you should have gathered enough experience that you can complete the program. Name your class WordStats You can test with the following user entry (enter it all on one line, then RETURN). This is sentence 1 . This is sentence number two. One more sentence makes number three. And finally, sentence number four is last. Output will look similar to this: ---jGRASP exec: java WordStats Enter sentences: This is sentence 1 . This is sentence number two. One more sentence makes number three. And finally, sentence number four is last. Number of words: 22 Number of Sentences: 4 Average words per sentence: 5.5 ---jGRASP: operation complete. ***** Workaround for Scanner .hasNext() method. Use this workaround if you have difficulty using the .hasNext() method on the Scanner that is created with System.in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
