Question: 6 . 2 9 LAB: Word frequencies - methods Define a method named getWordFrequency that takes an array of strings, the size of the array,
LAB: Word frequencies methods
Define a method named getWordFrequency that takes an array of strings, the size of the array, and a search word as parameters. Method getWordFrequency then returns the number of occurrences of the search word in the array parameter case insensitive
Then, write a main program that reads a list of words into an array, calls method getWordFrequency repeatedly, and outputs the words in the arrays with their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain less than words.
Ex: If the input is:
hey Hi Mark hi mark
the output is:
hey
Hi
Mark
hi
mark
Hint: Use the equalsIgnoreCase method for comparing strings, ignoring case.
The program must define and call a method:
public static int getWordFrequencyString wordsList, int listSize, String currWord
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
