For this assignment, you are to write a program that does the following: 1. Prompt the user for an input file name which contains text. For our test case, you will be using the file provided by your...

I have 4 files.txt that comes with the lab 5


For this assignment, you are to write a program that does the following: 1. Prompt the user for an input file name which contains text.  For our test case, you will be using the file provided by your instructor.   You can find the input file in blackboard as an attachment to the assignment. It contains the lyrics for Tom Tom Club’s “Wordy Rappinghood”.   To amuse yourself while coding, here’s the actual song: https://www.youtube.com/watch?v=6Vl1m5FYlAo  Since I am using an offshoot of the Talking Heads (Tom Tom Club), I may as well throw another one in for you.  Here’s “The Heads” with “The Damage I’ve Done”: (40) The Heads - Damage I've Done - YouTube 2. Read the file contents and parse it looking for words.  For this assignment, you can consider a word bounded by white space.  For instance, in the sentence: “Words are fun, and sometimes they aren’t fun.”   The words are: “Words”, “are”, “fun”, “and” “sometimes” “they” “aren’t” “fun”. 3. Use a class and instantiate objects to hold each unique word along with a count of that word as found in the input file.  For instance, for the sentence in #2, “Word” is found once, “are” is found once, “fun” is found twice, …   Your program should ignore numeric data (e.g. 0, 1, …) as well as punctuation (things like . , ; : - ) 4. Do NOT use a fixed size array to hold word strings or counts.  Your program should work regardless of the size of the input file.  My suggestion is to use an ArrayList of your word things (each object would have the word’s text along with a count of the number of times encountered).  The ArrayList will allow you to dynamically generate the list of words.  You should have appropriate getter and setter method on this class to get/set the word text as well as manipulate the word count.  (Alternatively, you could have parallel ArrayLists, one for the word (String), and one for the count (Integer)). 5. After processing the file, you will generate an output report that contains, with one word per line: a. The word itself b. The number of times it appears in the input file 6. Your program must handle exception conditions properly using try…catch logic.  For example, when you attempt to open the input file provided, you need to handle things like file not found conditions. 7. NOTE: wordy.txt contains the main test file (Tom Tom Club's song).  But please also test your code with the other txt files.      Please make sure you comment your code thoroughly use line comments when you want to emphasize something special that line of code does. The code should be nicely formatted and should use proper variables and variable names.  While we’ve sometimes jokingly used wacko variable names in class, please do not do so in your assignment. · user for an output report file name and write the report to this file with proper formatting.
Oct 09, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here