Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe the selection process.

Answered: 1 week ago

Question

Describe performance management.

Answered: 1 week ago

Question

Explain the importance of preliminary screening.

Answered: 1 week ago