The countNotInVocab method returns an int that contains the number of words in its parameter wordArray that are not found in the instance variable theVocab.A helper method, findWord, has been provided. The findWord method searches for an individual string in theVocab, returning true if an exact match between its String parameter and an element of theVocab is found, and returning false otherwise.(a) Write the countNotInVocab method. Assume that there are no duplicates in wordArray. You must use findWord appropriately to receive full credit./** Counts how many strings in wordArray are not found in theVocab, as described in* part (a).*/public int countNotInVocab(String[] wordArray)The notInVocab method returns an array of String objects that contains only elements of its parameter wordArray that are not found in theVocab. The array that is returned by notInVocab should have exactly one element for each word in wordArray that is not found in theVocab. Assume that there are no duplicates in wordArray.The following example illustrates the behavior of the notInVocab method.theVocab:"time" "food" "dogs" "cats" "health" "plants" "sports"​wordArray:"dogs" "toys" "sun" "plants" "time"Array returned by notInVocab:"toys" "sun"(b) Write the notInVocab method. Assume that there are no duplicates in wordArray. You must call findWord and countNotInVocab appropriately in order to receive full credit./** Returns an array containing strings from wordArray not found in theVocab,* as described in part (b).*/public String[] notInVocab(String[] wordArray)



Answer :

Other Questions