Question: Write a Java console application that analyzes a paragraph for readability using the ColemanLiau index. Prompt the user for a paragraph, and then calculate and
Write a Java console application that analyzes a paragraph for readability using the ColemanLiau index. Prompt the user for a paragraph, and then calculate and show the following:
Number of characters.
Number of whitespace characters.
Number of non-whitespace characters.
Number of sentences these are delimited by periods (.)
Number of words these are delimited by one or more spaces, commas, and periods.
Number of word letters.
ColemanLiau index this is calculated as follows:
1) Count the number of sentences.
2) Count the number of words.
3) Count the number of letters in words.
4) Calculate L = Letters Words 100.
5) Calculate S = Sentences Words 100.
6) Calculate CLI = 0.0588L - 0.296S - 15.8.
Format the output in two columns with the first column containing a label and the second column containing a value. Format the CLI to two decimal places. To test your program, use paragraph:
Existing computer programs that measure readability are based largely upon subroutines which estimate number of syllables, usually by counting vowels. The shortcoming in estimating syllables is that it necessitates keypunching the prose into the computer. There is no need to estimate syllables since word length in letters is a better predictor of readability than word length in syllables. Therefore, a new readability formula was computed that has for its predictors letters per 100 words and sentences per 100 words. Both predictors can be counted by an optical scanning device, and thus the formula makes it economically feasible for an organization such as the US Office of Education to calibrate the readability of all textbooks for the public school system.
You should get the following stats:
Characters: 765
Whitespace characters: 118
Non-whitespace characters: 647
Sentences: 5
Words: 119
Word letters: 639
L: 536.97
S: 4.20
CLI: 14.53
Use this paragraph for the last run:
Apollo 11 was the spaceflight that landed the first two humans on the Moon. Mission commander Neil Armstrong and pilot Buzz Aldrin, both American, landed the lunar module Eagle on July 20, 1969. Armstrong became the first to step onto the lunar surface six hours later on July 21. Aldrin joined him about 20 minutes later. They spent about two and a quarter hours together outside the spacecraft, and collected lunar material to bring back to Earth. Michael Collins piloted the command module Columbia alone in lunar orbit while they were on the Moon's surface. Armstrong and Aldrin spent just under a day on the lunar surface before rendezvousing with Columbia in lunar orbit.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
