Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 getLetterTally() { // execution } }

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 letterTally = analyzer.getLetterTally(); System.out.println("Words: " + Arrays.toString(words)); System.out.println("Smallest words: " + Arrays.toString(smallestWords)); System.out.println("Largest words: " + Arrays.toString(largestWords)); System.out.println("Average word length: " + averageWordLength); System.out.println("Letter count: " + letterTally); } else { System.out.println("Invalid express"); } } }I

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

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago