CST8284_521 Assignment# 4
What to submit: WordOccurences.javaChallengeWrite a program (WordOccurrences.java) that would open any text based file and writes to a file the list of unique words along with their occurrence. A word can be a combination of any number of alphanumeric characters, from 1 and up.The program would prompt the user to enter the path to the text file, opens it, reads the content, either one line at time or else, I will leave it up to you, splits the words based on white space, stores every unique word, and count its occurrence, which would be 1 by default for every word read and then the occurrence would increment for every additional occurrence of an existing word encountered. Treat uppercase and lowercase letters the same. Ignore punctuation.The output of this program needs to be written into a file that should hold the same name of the input file but with _Out tagged to the end of its name, just before the .extension; i.e. the .txt for example. So, if input file is MyInputFile.txt, the output file should be MyInputFile_Out.txt.No need for the input file to be very large but with enough data to cover the requirements.The alignment of the occurrence needs to be one tab (t) past the longest word in the file read.Make use of the Map interface 😉Here is a sample output:Input File content (Yours needs to be a bit longer than this)Write a program that would open any text based file and writes to a file the list of unique words along with their occurrence. A word can be a combination of any number of characters, from 1 and up.Output File contentWrite 1a 4program 1that 1would 1open 1any 2text 1based 1file 2and 2writes 1to 1the 1list 1of 3unique 1words 1along 1with 1their 1occurrence 1word 1can 1be 1combination 1number 1characters 1from 11 1up 1
Reviews
There are no reviews yet.