Question: avgWordLength ( ) Method Write a method called avgWordLength ( ) that takes in an Array of String, and returns the average length of the
avgWordLength Method
Write a method called avgWordLength that takes in an Array of String, and returns the average length of the Strings in the Array. Remember, that an average is of type double.
Your goal is to do the following:
Traverse the Array
Find the average length of all of the words that are part of words Array.
Return the average length.
import java.io;
import java.util.;
import java.text.;
import java.math.;
import java.util.regex.;
public class CodingQuestion
Write your static method here
DO NOT CHANGE THE CODE BELOW THIS LINE
public static void mainString args
Scanner in new ScannerSystemin;
String words new String;
for int i ; i ; i
wordsi innextLine;
double avgLength avgWordLengthwords;
System.out.printlnThe average word length is avgLength ;
end of main
Expected STDOUT
The average word length is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
