Question: 6 . 2 9 LAB: Word frequencies - methods Define a method named getWordFrequency that takes an array of strings, the size of the array,

6.29 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 20 words.
Ex: If the input is:
5 hey Hi Mark hi mark
the output is:
hey 1
Hi 2
Mark 2
hi 2
mark 2
Hint: Use the equalsIgnoreCase() method for comparing strings, ignoring case.
The program must define and call a method:
public static int getWordFrequency(String[] wordsList, int listSize, String currWord)
548982.4068734.q3zgy7
 6.29 LAB: Word frequencies - methods Define a method named getWordFrequency

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!