Question
In this problem, you will need to implement each of the methods MIN, MAX, RANGE, AVERAGE, and MODE for the use case of word length
In this problem, you will need to implement each of the methods MIN, MAX, RANGE, AVERAGE, and MODE for the use case of word length analysis. For this purpose, extend the skeleton code provided alongside this assignment in iCollege. For a given input array containing strings you should implement the following methods. The words in the array will not necessarily be sorted. 1. Implement the minWordLength() method, which should return the length of the smallest word in the array. 2. Implement a method called maxWordLength(), which should return the length of the largest word in the array. 3. Implement a method called wordLengthRange(), which should return the range of lengths in the word array. 1 4. Implement a method called averageWordLength(), which should return the average word length in the word array. The method should return the average, accurate to exactly two decimal places (i.e. if the average length is 5, return 5.00). 5. Implement a method called mostCommonWordLength(), which should return the most common length of the words in the array. 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. In case the input array is empty, each method should return -1. Call these methods in this order: minWordLength(), maxWordLength(), wordLengthRange(), averageWordLength(), mostCommonWordLength().
Each individual result must be output and appear in a single line. The example output for the input array ["good", "afternoon", "how", "are", "you", "today"] will look like this: 3 9 6 4.50 3
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