Repeat the previous problem except create your own class, Name, that is added to a HashMap instead of a HashSet. The Name class should have three private variables, a String to store the name, an integer to store the number of namings for girls, and an integer to store the number of namings for boys. Use the first name as the key to the HashMap. The value to store is the Name object. Instead of ignoring the number of namings, as in the previous project, store the number in the Name class. Make the ArrayList a list of Name objects; each time you find a common name, add the entire Name object to the list. Your program should then iterate through the ArrayList and output each common name, along with the number of boy and girl namings.
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.