Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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) Implement the minWordLength() method, which should return the length of the smallest word in the list.

(b) Implement a method called maxWordLength(), which should return the length of the largest word in the list.

(c) Implement a method called wordLengthRange(), which should return the range of lengths in the word list.

(d) Implement a method called averageWordLength(), which should return the average word length in the word list. The method should return the average, accurate to exactly two decimal places (i.e. if the average length is 5, return 5.00).

(e) Implement a method called mostCommonWordLength(), 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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

With reference to Exercise 3.28, find P(0.8 Answered: 1 week ago

Answered: 1 week ago

Question

=+what kinds of policies and practices should be developed?

Answered: 1 week ago

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago