Java Programming: The code is on the link: https://drive.google.com/file/d/1LREFW0M1O3G7v5Zpiy0AE0eI6siReedx/view?usp=sharing Thank you in advance.
Java Programming: Complete the two methods in the MapsLab program 1) The first method accepts a String and builds a Map containing each character in the String along with the number of times the character appears. All characters are counted, including blanks. 2) The second method accepts a String and builds a Map containing each word in the String along with the number of times the word appears. To access each word from the String, you can build a Scanner and use the next0 method import java.util.* public class MapsLab f public static void main (String[ args) i Map
(); Map wordCount3 new HashMap(); string lyrics! = "WORDS ARE FLOWING OUT LIKE AN ENDLESS RAIN INTO A PAPER CUP"; String lyrics2 "I AM HE AS YOU ARE HE AS YOU ARE ME AND WE ARE ALL TOGETHER". countChars (lyricsl, charCounts) System.out.println ("Character counts:+ charCounts) wordLengths (lyrics2, wordCounts) System.out.println ("Character counts:"t wordCounts) **Takes characters from a String object and uses them to build the corresponding character counts in a map. Accepts two arguments: ?param str - String containing characters to be counted param map An (initially empty) Map that will contain each character and the number of times it appears in the string. public static void countChars (String str, Map map) /Takes words from a String object and uses them to build a map whose keys are the words and whose values are the number of times each word appears Accepts two arguments: 2param str- String containing words to be stored in the map Eparam map An (initially empty) Map that will contain each word and its frequency public static void wordLengths (String str, Hap map) Java Programming: Complete the two methods in the MapsLab program 1) The first method accepts a String and builds a Map containing each character in the String along with the number of times the character appears. All characters are counted, including blanks. 2) The second method accepts a String and builds a Map containing each word in the String along with the number of times the word appears. To access each word from the String, you can build a Scanner and use the next0 method import java.util.* public class MapsLab f public static void main (String[ args) i Map(); Map wordCount3 new HashMap(); string lyrics! = "WORDS ARE FLOWING OUT LIKE AN ENDLESS RAIN INTO A PAPER CUP"; String lyrics2 "I AM HE AS YOU ARE HE AS YOU ARE ME AND WE ARE ALL TOGETHER". countChars (lyricsl, charCounts) System.out.println ("Character counts:+ charCounts) wordLengths (lyrics2, wordCounts) System.out.println ("Character counts:"t wordCounts) **Takes characters from a String object and uses them to build the corresponding character counts in a map. Accepts two arguments: ?param str - String containing characters to be counted param map An (initially empty) Map that will contain each character and the number of times it appears in the string. public static void countChars (String str, Map map) /Takes words from a String object and uses them to build a map whose keys are the words and whose values are the number of times each word appears Accepts two arguments: 2param str- String containing words to be stored in the map Eparam map An (initially empty) Map that will contain each word and its frequency public static void wordLengths (String str, Hap map)