Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java program that will read from an input file named inPoem.txt found in the current directory. The program will analyze the words found in the

Java program that will read from an input file named inPoem.txt found in the current directory.

The program will analyze the words found in the input file.

The output will display:

  • a sorted list of words in ascending order
  • the frequency of each word in the input file
  • if the word is a palindrome
    • a palindrome has values that are the same from front to back and back to front - such as the words "radar" and "madam", for example.

The input file size will vary so be sure to read until end of file. Be sure to discard any punctuation that may follow a word, such as:

  • end of sentence punctuation (period, question mark, exclamation mark)
  • basic punctuation (comma, semicolon, colon, apostrophe, quotes, etc...)

An Example:

if the input file contains:

Star light, Star bright, First star I see tonight.

The output would be:

Poem Word Analysis

Opening input file....

Word Frequency Palindrome

bright 1 false First 1 false I 1 true light 1 false see 1 false Star 2 false star 1 false tonight 1 false

End of results.

Be sure to:

  • set the path of the input file to the project current directory
  • use an ArrayList or parallel arrays to hold the list of words, their frequency, and palindrome status
  • format the output values as shown in the above example with columns to separate the output values going across
  • create a class named InputFile that controls all file maintenance (opening, reading, closing the input file)
  • create a class named Analysis that will control the list of words, frequency of words, and palindrome information
  • use constructors, mutators, and accessor methods for all variables where appropriate
  • add a heading and ending statement to the output
  • create a .java file for each class for a total of 3 .java files when the project is complete

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Starting Out With Python Global Edition

Authors: Tony Gaddis

4th Edition

1292225750, 9781292225753

More Books

Students also viewed these Programming questions

Question

Cite ways to overcome fear of success.

Answered: 1 week ago