Question: In java. Do not use c++ or python. Your program should: 1. Read the name of the text file from the console. 2. Read in

In java. Do not use c++ or python. Your program should: 1. Read the name of the text file from the console. 2. Read in a text file, not all at once. (This can be line by line, word by word or character by character.) 3. The file content must be converted to a sequence of words, discarding punctuation and folding all letters into lower case. 4. Store the unique words and maintain a count of each different word. 5. The words should be ordered by decreasing count and, if there are multiple words with the same count, alphabetically. (This ordering may be achieved as the words are read in, partially as the words are read or at the end of all input processing.) 6. Output the first ten words in the sorted list, along with their counts. 7. Output the last ten words in the list, along with their counts. You must choose appropriate data structures and algorithms to accomplish this task. Note: in the context of this assignment, appropriate choices will be efficient and will not use excessive instructions or data. Note: where a punctuation mark appears between two letters, the sequence is to be treated as a single word. Thus, its will become its, youll will become youll and loop-hole will become loophole. Note: you can assume that the input file contains no more than 50,000 different words. Note: a small sample input file sample.txt is provided for you to test your program. A larger text file will be used for final assessment. Note: you may use any data structures or algorithms that have been presented in class up to the end of week 4. If you use other data structures or algorithms appropriate references must be provided. Programs must compile and run under gcc (C programs), g++ (C++ programs) java or python. Programs which do not compile and run will receive no marks. Programs should be appropriately documented with comments. All coding must be your own work. Standard libraries of data structures and algorithms such as STL may not be used, nor may code be sourced from textbooks, the internet, etc.

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!