Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. (10 points) Write a function called analyzeText that accepts a string as inpu

ID: 3774694 • Letter: 2

Question

2. (10 points) Write a function called analyzeText that accepts a string as input and (1) counts the number of words; (2) identifies the length of the longest word; and (3) identifies the greatest number of vowels (a, e, i, o, u) in a word. The function will be called as follows: InumWords, maxwordLength, maxNumvowels) analyze Text (text) where the variable text contains the string supplied to the function, numWords returns the number of words, maxWordLength returns the length of the longest word in the string, and maxNumVowels returns the greatest number of vowels present in any word Following are examples of correct function behavior: Inw, mwl, mnv] analyze Text The woods are lovely dark and deep') n W mwl mn V F In mwl, mnv] analyze Text But I have promises to keep') n W mwl mlnv F If you are using the strtok function to tokenize the string, read the release notes regarding its behavior: https ://www.mathworks.com/help/matlab/ref/strtok.html

Explanation / Answer

Below, is a pastebin link that contains the solution.

http://pastebin.com/ruhcsnqr

Approach :-

1. Split the given texts by spaces, this will give you a list and the length of list will determine the numberofwords.

2. for each word calculate length and update maxlength.

3. for each word calculate vowel count and update maxvowlecount.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote