Question: JAVA QUESTION JAVADOC all parts Deliverables - Part1 program and output file Part 1- Only 1 Part !!!!!!!!!! Purpose:This will list the number of distinct

JAVA QUESTION

JAVADOC all parts

Deliverables - Part1 program and output file

Part 1- Only 1 Part !!!!!!!!!!

Purpose:This will list the number of distinct words in Green Eggs and Ham and provide a count for how many times each is used. I will leave the implementation up to you. What I want is output file that looks like

do :35

anywhere :6

good :2

mouse :8

mot :1

Like :1

would :17

ham :10

me :4

Here is a textfile: https://docs.google.com/document/d/1gyJEcO9PgjosRu2f_fj91ouHqVXXeZFnjVNWCaQo49s/edit?usp=sharing with the words. I would suggest you use a HashMap for this because a map is an object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

The word would be the key and the value would start at 1 the first time you find the word in the file and then increment it each subsequent time you find the same word.

HASHMAP do not have duplicates You will need a try and catch to read a file.

Steps - use examples from Thursday

Lots of imports - file io and HashMap

Use try/catch to open file

Define a HashMap with a String key and an Integer value

Use while loop to read

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!