Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Counting the Words In this exercise, you need to create a program that Prompts the user to open a text file, Read the file Records

Counting the Words

In this exercise, you need to create a program that

  1. Prompts the user to open a text file,
  2. Read the file
  3. Records every different word in the file, and how many times that word appears.
  4. Create a new .txt file and write the collected data to it.

First, begin by making the code that opens and reads a text file (this section must contain a try-catch for both user input and accessing the file). DO NOT hard code the file location into your code, because it will not be in the same directory when I go to grade it, and thus it will not make it past step 1, which means the assignment is failed.

Next, build your scanner that reads a string at a time. Then make 2 arrays; one int, and one String (size 100 is plenty for testing). If the String youve just read is not in the String array add the string. If it is, increase the instances of that string in the int array.

Finally, use the print writer to create a new text file and transfer the information in your arrays to this new file in two columns.

Now create or download a sample text file and test your program.

For this program, in addition to the java file, UML, and readme, please submit your sample text, and a screenshot of the results from your testing.

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

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

Students also viewed these Databases questions

Question

3. How has e-commerce transformed marketing?

Answered: 1 week ago