Question: Create a package called wordprocessor Create a class in wordprocessor called WordProcessor that will the count the words in the data file o Private variables:
Create a package called wordprocessor Create a class in wordprocessor called WordProcessor that will the count the words in the data file o Private variables: file (File), scnr (Scanner), words (ArrayList of Strings), counts (ArrayList of Integers). o Constructor has the file name as the argument. It will instantiate the file, scanner, and the array lists as empty lists. o You do not need accessors or mutators for this class o Private method called counting. This method will read in the words from the text file one at a time. If the word is not in the array list of words, it will need to be added and the corresponding index in the counts array list will need to be set to 1. If the word already exists in the word list, the corresponding count must be incremented by one. o Private method called displayCount. This method will display the array list of words and their counts Each word should be its own line as "count word". Leave room for 4 characters for the count, a space, then the world. For example: 1 turmoil 17 has 1 engulfed 77 the o Public method called countWords that is invoked to process the file and display the results. Create a package called driver Create a class in driver called Driver that will instantiate a WordProcessor and display the result of counting the words in the data file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
