Question: JAVA In this method I need to seperate input from command line arguments to words and split in an array. However this method also recognize

JAVA
In this method I need to seperate input from command line arguments to words and split in an array. However this method also recognize ',' and '.' as a string.
As the output below, in the "Largest word(s)" it recognize "blue." as a words, but it should be only "red" and "blue" as a word.
How can I ignore the "," and "." when spliting words?
JAVAIn this method I need to seperate input from command line arguments
to words and split in an array. However this method also recognize

Olic elass PhraseAnalyzert public static void main (String[l args) ( if (isvalidphrase(args)) f // Phrases are valid 1 public static boolean isValidphrase (String [] phrase) ( 1+x public static string[] getwords (String[] phrase) I String ] words = new String [0]; for (String arg : phrase) String [] argwords = arg.split (" ")|; words = Arrays. copyof (words, words. length + argwords. length) ; System.arraycopy (argwords, 0, words, words. 1ength - argwords.length, argwords. length) : 1 return words; 1 y public static String getSmallestWords (String[] words) ( sec public static String getLargestWords (String[] words) ( 1+k public static double getAverageWorldtength(String[] words) ( SUSQLAPTOP-SOMKDA2M MINGW64 /Project2/src java PhraseAnalyzer. java Roses are red, some roses are blue. smallest word(s): are argest word(s): Roses, roses, blue. Average word 7ength: 4.14 east frequently used letter(s): b, d, 1, m, u lost frequently used letter (s): e Olic elass PhraseAnalyzert public static void main (String[l args) ( if (isvalidphrase(args)) f // Phrases are valid 1 public static boolean isValidphrase (String [] phrase) ( 1+x public static string[] getwords (String[] phrase) I String ] words = new String [0]; for (String arg : phrase) String [] argwords = arg.split (" ")|; words = Arrays. copyof (words, words. length + argwords. length) ; System.arraycopy (argwords, 0, words, words. 1ength - argwords.length, argwords. length) : 1 return words; 1 y public static String getSmallestWords (String[] words) ( sec public static String getLargestWords (String[] words) ( 1+k public static double getAverageWorldtength(String[] words) ( SUSQLAPTOP-SOMKDA2M MINGW64 /Project2/src java PhraseAnalyzer. java Roses are red, some roses are blue. smallest word(s): are argest word(s): Roses, roses, blue. Average word 7ength: 4.14 east frequently used letter(s): b, d, 1, m, u lost frequently used letter (s): e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!