Question: Help with SIMPLE Java programs! There are 2 simple programs, 1st one in 1st picture and the 2nd one in 2nd picture. The 3rd picture
Program 1: Sentence Analysis Write a program to read a sentence (a String) entered by the user and display the following statistics: 1. the number of words in the sentence: 2. the length of each word (the number of characters): 3. the length of the longest word; 4. the length of the shortest word: 5. the average length of words. Here is an example of how your program should behave (assume that the data in grey has been entered by the user: Welcome to the SENTENCE ANALYZER Please enter the sentence to analyse: Assignment 2 does not work. Here are some stats on your sentence: Word 1 has 11 characters. Word 2 has 4 characters. Word 3 has 3 characters. Word 4 has 4 characters. There are 4 words. The longest word has 11 characters The shortest word has 3 characters. The average word length is 5.5 characters. u for usin the SENTENCE ANALY2ER Thank Notes: You can assume that a sentence will always fit within a line so you can use next Line to read the sentence. A sentence will always finish with a punctuation mark (eg, a period, aquestion mark, which should not be considered as part of the last word. A word is considered to be any sequence of non-white characters. For example, they're is considered to be 1 word, but they are is considered 2 words. You can assume that the words will always be followed by l and only 1 white space (except for the last word which is followed by a punctuation)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
