Question
I would like some help in completing this exercise. Thank You public class WordTally { /** Declare instance variables. */ /** * Default constructor. Initialize
I would like some help in completing this exercise. Thank You
public class WordTally {
/** Declare instance variables. */
/** * Default constructor. Initialize the instance variables in this method. * */ public WordTally() { throw new UnsupportedOperationException("replace with your implementation"); }
/** * This method returns the raw count of the words in the book. A word can be * counted multiple times if it appears multiple times. * * @return the raw count of the words in the book */ public int getRawCount() { throw new UnsupportedOperationException("replace with your implementation"); }
/** * This method returns the unique count of the words in the book. A word must be * counted only once when it appears multiple times. * * @return the unique count of the words in the book */ public int getUniqueCount() { throw new UnsupportedOperationException("replace with your implementation"); }
/** * This method returns the average length of the words used in the book. The * average length has to be formatted in a String with the following statement: * * Assuming that averageLength is the variable that contains the average word * length, * * String s = String.format("%.2f", averageLength); * * @return the average length of the words in the book in a String format */ public String avgWordLength() { throw new UnsupportedOperationException("replace with your implementation"); }
/** * This method returns the length of the longest word used in the book * * @return the length of the longest word in the book */ public int longestWord() { throw new UnsupportedOperationException("replace with your implementation"); }
/** * This method returns how many times a word appear in the book * * @param ow * a Word object * @return the number of occurrences of the input word */ public int freqWord(Word ow) { throw new UnsupportedOperationException("replace with your implementation"); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started