Prog #5: SpeechGrade SOlution

$35.00 $24.00

3/21 Modified rules to only subtract one for adjacent vowels inside a word, to properly handle words like “flea”. Also combined rules 3 & 4 into an “if-else” rule to avoid subtracting two times for a word ending in “le”. Hyphens (‘-‘) should also separate words. The letter ‘Y’ now counts as a vowel. According…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

3/21 Modified rules to only subtract one for adjacent vowels inside a word, to properly handle words like “flea”. Also combined rules 3 & 4 into an “if-else” rule to avoid subtracting two times for a word ending in “le”. Hyphens (‘-‘) should also separate words. The letter ‘Y’ now counts as a vowel.

According to a October 20, 2015 Boston Globe article, Trump’s presidential announcement speech “could have been comprehended by a fourth-grader” according to an algorithm called the Flesch-Kincaid (F-K) grade level test. News articles are sometimes inflammatory, prone to exaggeration for the sake of generating interest. So, is the claim about Trump’s speech true? How does Trump’s presidential announcement speech compare to other candidates’ announcement speeches? (Note that this is a separate issue from whether or not simpler is better!)

Comparing these speeches is our task for this assignment. Take the recent presidential announcement speeches and print out a table of them according to the F-K grade level test, with the lowest grade level at the top of the list, and the highest grade-level at the bottom. You should be able to compare your results at readability-score.com. The F-K test (from this wikipedia page) is:

Words are separated from each other by whitespace (space, tab, or newline), or hyphen (respectively ASCII codes 32, 9, (10 or 13), 45)
The end of a sentence is denoted by a period, question mark or exclamation mark followed by whitespace or quotes.
You can count the number of syllables in words by using the following rules (modified from here) that aren’t perfect, but get us pretty close:
1. Start with the number of syllables being the count of the number of vowels (a,e,i,o,u) or ‘y’ letters in the word. (e.g. who, sending, gym)
2. Subtract one each time there are 2 adjacent vowels (or ‘y’) within a word (i.e. not at the end). For instance “rain” has 2 vowels but is only 1 syllable. For “yellow” we end up with only 2 syllables.
3. If a word ends with a vowel-consonant-‘e’ (such as “bale” or “cute”) or vowel-consonant-“es” (such as “files” or “drives”)
subtract 1
else if a word ends with a vowel (e.g. “torte” or “you”) and has more than one syllable (not “hi”)
subtract 1
The format of running the program should look like what is below, though the data here is made up and only the first 3 rows are shown:
Author: Dale Reed
Program #5: SpeechGrade
TA: Elliott Ness, T 6:00 AM
March 12, 2016
System: XCode on Mac

Presidential Announcement Speech reading grade levels:
10.7 Graham, Linsey
8.5 Paul, Rand
8.0 Fiorina, Carly
. . .
See Speeches.zip for the presidential announcement speeches of the following 17 Democrats and Republicans:
JebBush
BenCarson
ChrisChristie
HillaryClinton
TedCruz
CarlyFiorina
LindseyGraham
MikeHuckabee
JohnKasich
RandPaul
RickPerry
MarcoRubio
BernieSanders
RickSantorum
DonaldTrump
ScottWalker
JamesWebb
I suggest you copy and paste the following names into an array so that you can handle each one individually. Just for fun (but no extra credit) you could also look at all the US Presidential inaugural addresses and see if/how grade level has changed over time. All the inaugural addresses can be found at the UC Santa Barbara American Presidency Project
Turning In Your Program
While you had the opportunity to work with a partner on programs 3 and 4, the remaining programs must be done independently.
1. The name of the program you will turn in should be prog5 followed by your netid and the .cpp file extension. In other words, if your netid is reed then your program would be called prog5reed.cpp
2. You must also zip up the single file you turn in. After zipping your program (e.g.prog5reed.cpp), you will likely end up with a file called something like prog5reed.zip. Only turn in this single file, turning it in on Blackboard into the assignment Program5: SpeechGrade. Do not turn in the speech files. Your program must use exactly the given speech files, with the file names as given.
Failing to follow these naming conventions and failure to turn in a single zip file will result in a 5 point deduction, even if everything else is perfect in your program.