Due: Friday, Nov 7th by 11:59 PM
Import CS201_Lab16.zip (File->Import...->General->Existing Projects into Workspace->Archive File). You should see a project called CS201_Lab16 in the Package Explorer.
Complete the program so that it counts the number of occurrences of words in the text file whose name is entered by the user, and then prints out a histogram showing the number of occurrences of each word (in lower case), listing the words alphabetically.
Code is provided which
An example text file, gettysburg.txt, is provided for you to use when testing your program.
Here is partial output from running the program on this file:
Read which file? gettysburg.txt Word counts: a : ======= above : = add : = advanced : = ago : = all : = altogether : = and : ====== any : = are : === as : = battle : =
The length of the "bar" following each word indicates the number of occurrences of that word. For example, the word "and" occurred 6 times, so there are six "=" characters making up the bar for that word.
There are 126 more lines of output.
Use a map with key type String and value type Integer to count the number of occurrences of each word.
You are required to list the words alphabetically when displaying the histogram. Can you choose a built-in implementation of the Map interface that will make this job easier?
You should determine the length of the longest word so that the "bars" of the histogram will all start in the same column when printed.