In the main() method, create two arrays: String[] wordsFromFile1; String[] wordsFromFile2; Read "GettysburgAddress.txt" file and "SecondInauguralAddress.txt" file. Store their words into these two arrays. Create a method: public static void calculateTokenCounts(String[] raw, String[] tokens, int[] counts) where raw is the raw String[] array we got from getFileWords() method. String[] tokens and int[] counts are defined before calling the method. After method execution, the tokens and their counts in the raw array should be added to the the tokens and counts array. Note that the tokens and counts array may already have data in them. You can not do a fresh overwrite. Then create two arrays
In the main() method, create two arrays:
String[] wordsFromFile1;
String[] wordsFromFile2;
Read "GettysburgAddress.txt" file and "SecondInauguralAddress.txt" file. Store their words into these two arrays.
Create a method:
public static void calculateTokenCounts(String[] raw, String[] tokens, int[] counts)
where raw is the raw String[] array we got from getFileWords() method. String[] tokens and int[] counts are defined before calling the method.
After method execution, the tokens and their counts in the raw array should be added to the the tokens and counts array.
Note that the tokens and counts array may already have data in them. You can not do a fresh overwrite.
Then create two arrays:
String[] totalTokens
int[] totalCounts
use calculateTokenCounts () method to populate the latter two arrays with data from the two wordsFromFileX array.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images