Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.lang.UnsupportedOperationException; import java.util.Scanner; public class Dictionary { // Constants for function names in input public static final String MIN_METHOD_NAME = MIN; public static final

image text in transcribed

image text in transcribed

import java.lang.UnsupportedOperationException; import java.util.Scanner;

public class Dictionary { // Constants for function names in input public static final String MIN_METHOD_NAME = "MIN"; public static final String MAX_METHOD_NAME = "MAX"; public static final String RANGE_METHOD_NAME = "RANGE"; public static final String AVERAGE_METHOD_NAME = "AVERAGE"; public static final String MODE_METHOD_NAME = "MODE"; public static void main(String[] args) { Scanner sc = new Scanner(System.in); // Read in the method name that we want to call String methodName = sc.nextLine(); // Read in number of words int numWords = Integer.parseInt(sc.nextLine()); // Read in list of words String[] words = new String[numWords]; for (int i = 0; i

Add to starter code, with some comments(beginner here)

code using Java

(30 points) In this problem, we will implement a simple dictionary of common words in the English language, represented as an array of words paired with their lengths. You will need to implement each of the below methods in the Dictionary class In this problem, the first line of input represents the method to call. It will be one of the following: MIN, MAX, RANGE, AVERAGE, MODE. The second line will represent an integer n, which denotes the number of words in the list. The following n lines will each be a word. The words will not necessarily be sorted. Your output should be a single line representing the results of the method (a) (4 points) Implement the minWordLength() method, which should (b) (4 points) Implement a method called maxWordLength() method, (c) (3 points) Implement a method called wordLengthRangeO, which (d) (4 points) Implement a method called averageWordLength), which return the length of the smallest word in the list which should return the length of the largest word in the list should return the range of lengths in the word list should return the average word length in the word list. The method should return a string representing the average, accurate to exactly two decimal places (i.e. if the average length is 5, return 5.00). (e) (3 points) Implement a method called mostCommonHordLengtho, which should return the most common length of the words in the list. If there is a tie, you should return -1. You may assume that the length of a word is at most 100 and at least 1

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

(a) Show that p ( [q( ( p q)] (b) True or false? p([q ( (p q)]

Answered: 1 week ago

Question

Evaluate the integral. 5x + 3x - 2 x + 2x .3 dx

Answered: 1 week ago