Question
I'm new to coding and so I can't seem to figure out how to complete the rest of this example program. Help was already given
I'm new to coding and so I can't seem to figure out how to complete the rest of this example program. Help was already given on how to create the format.
Example:
Need help with figuring out how to complete this coding example.
Ex) Create a PhraseAnalyzer program using isValidPhrase(), getWords(), getSmallestWords(), getLargestWords(), getAverageWordLength(), and getLetterTally() methods. The program should prompt the user to insert a phrase and the program should produce a list including the smallest word used, largest word used, average word length, least frequently used letters, and most frequently used letter. The phrase must also be valid, meaning characters that are not letters or not valid but letters that do not form a word can still count as a word. Ex: asdhj is considered valid.
Please provide javadoc so I can understand the methods used.
import java.util.*;
/** * The PhraseAnalyzer class breaks down phrases and gives data about them. */ public class PhraseAnalyzer { confidential String phrase;
/** * Builds a PhraseAnalyzer object with the given expression. * * @param state the expression to be broke down */ public PhraseAnalyzer(String phrase) { this.phrase = express; }
/** * Checks whether the expression is legitimate. * * @return valid in the event that the expression is substantial, bogus in any case */ public boolean isValidPhrase() { // execution }
/** * Returns a variety of words in the expression. * * @return a variety of words in the expression */ public String[] getWords() { // execution }
/** * Returns the littlest words in the expression. * * @return the littlest words in the expression */ public String[] getSmallestWords() { // execution }
/** * Returns the biggest words in the expression. * * @return the biggest words in the expression */ public String[] getLargestWords() { // execution }
/** * Returns the typical word length in the expression. * * @return the typical word length in the expression */ public twofold getAverageWordLength() { // execution }
/** * Returns a guide of letter counts in the expression. * * @return a guide of letter counts in the expression */ public Map
public class Principal { public static void main(String[] args) { Scanner = new Scanner(System.in); System.out.print("Enter an expression: "); String phrase = scanner.nextLine(); PhraseAnalyzer analyzer = new PhraseAnalyzer(phrase); in the event that (analyzer.isValidPhrase()) { String[] words = analyzer.getWords(); String[] smallestWords = analyzer.getSmallestWords(); String[] largestWords = analyzer.getLargestWords(); twofold averageWordLength = analyzer.getAverageWordLength(); Map
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