[Solved]Baby Name Popularity Ranking Popularity Ranking Baby Names Years 2008 2017 Downloaded Wwws Q37071623
(Baby name popularity ranking) The popularity ranking ofbaby names from years 2008 to 2017 can be downloaded fromwww.ssa.gov/oact/babynames and stored in files namedbabynameranking2008.txt, babynameranking2009.txt, . . . ,babynameranking2017.txt. You can download these from Google Drive.Each file contains 1,000 lines. Each line contains a ranking, aboy’s name, number for the boy’s name, a girl’s name, and numberfor the girl’s name. For example, the first two lines in the filebabynameranking2017.txt are as follows:
1 Liam 18,728 Emma 19,738
2 Noah 18,326 Olivia 18,632
Write a program that enables the user to select a year,gender, and enter a name to display the ranking of the name for theselected year and gender, as shown below. To achieve the bestefficiency, create two arrays for boy’s names and girl’s names,respectively. Each array has 10 elements for 10 years. Each elementis a map that stores a name and its ranking in a pair with the nameas the key.
Enter a year: 2016
Boy or Girl? Boy
Enter a name: Liam
Boy name Liam is ranked #2 in 2017
Enter a year: 2011
Boy or Girl? Girl
Enter a name: Hannah
Girl name Hannah is ranked #25 in 2011
import java.io.*;
import java.util.*;
public class Lab08{
@SuppressWarnings(“unchecked”)
private static Map[] boys = newHashMap[10];
@SuppressWarnings(“unchecked”)
private static Map[] girls = newHashMap[10];
public static void main(String[] args)throws IOException {
Scannerinput = new Scanner(System.in);
String answer;
readNames(); // method to read theinfo from the files and add to our Map array
//Get user input and continue until done
do {
System.out.print(“ENter a year (2008-2017):”);
int year =input.nextInt();input.nextLine();
System.out.print(“Boy or girl? “);
String sex =input.nextLine().toLowerCase();
System.out.print(“ENter a name: “);
String name = input.nextLine();
switch (sex) {
// display the output based on the sex (boy orgirl)
}
System.out.print(“Do you want check another name (yes orno)?”);
answer = input.nextLine().toLowerCase();
} while (answer.equals(“yes”));
} // endmain
//read information from each file and add to appropriateMap array
public static void readNames() throws IOException{
File infile;
for(int i=0;i<10;++i) {
boys[i] = new HashMap<>();
girls[i] = new HashMap<>();
}
for(int i=0;i<=9;++i) {
// construct the file name
String filename = // construct the file name;
infile = new File(filename);
Scanner in = new Scanner(infile);
while(in.hasNext()) {
// read info from the file and add to Maparrays
} // end while
in.close();
} // end for loop
} // end readNames()
} // end Lab08
baby names download below please
https://drive.google.com/file/d/1BlltxC1dae5FTskXD_TrpqX9cORBoOkG/view?usp=sharing
Expert Answer
Answer to (Baby name popularity ranking) The popularity ranking of baby names from years 2008 to 2017 can be downloaded from www.s… . . .
OR

