Question: Please use MATLAB! Thank you. (10 Points) Note, this problem is more difficult and worth less points than the previous problems. Make sure you have

 Please use MATLAB! Thank you. (10 Points) Note, this problem is

Please use MATLAB!

Thank you.

(10 Points) Note, this problem is more difficult and worth less points than the previous problems. Make sure you have answered all previous problems satisfactorily before working on this problem rite a function that takes in a sentence and a word and then returns the number of times the word occurs in that sentence (ignoring case) To approach this problem, you should begin by comparing the first letter in the word h each letter (one at a time) in the sentence. If those two letters match, then loop over the rest of the word, comparing it with each subsequent letter in the sentence If all the rest of the letters match, then you have found a match. Either way you will then commence looking at the rest of the sentence starting at subsequent letter in sentence For example, if the sentence contains "She was a hotshot.", and the word we are looking for is "Hot", there should be two matches. In the first iteration, we compare the "H" (the 1st letter of "hot"), to the "S" (the 1st letter from the sentence). They do not match, so we move on. We start again by comparing the "H" (in "Hot") to the"h" (2nd letter of the sentence). As they match (remember you must ignore case) the you would compare the "o" (the 2nd letter in "hot") to the "e" (the next letter in the sentence). Since these two letters do not match, there is no match and we start again with comparing the "H" (we always start with the 1st letter of "Hot") to the "e" in the sentence (ie, since this is the 3rd iteration, we are starting with the 3rd letter in the sentence). When done call your function and display the result like: The word occurred_times

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!