The text file babynames2004.txt, which is included in the source code for this book and is available online from the book’s Web site, contains a list of the 1000 most popular boy and girl names in the United States for the year 2004 as compiled by the Social Security Administration.
This is a space-delimited file of 1000 entries in which the rank is listed first, followed by the corresponding boy name and girl name. The most popular names are listed first and the least popular names are listed last. For example, the file begins with
1Jacob Emily
2Michael Emma
3Joshua Madison
This indicates that Jacob is die most popular boy name and Emily is the most popular girl name. Michael is the second most popular boy name and Emma is the second most popular girl name.
Write a program that allows the user to input a name. The program should then read from the file and search for a matching name among the girls and boys. If a match is found, it should output the rank of the name. The program should also indicate if there is 110 match.
For example, if the user enters the name “Justice,” then the program should output:
Justice is ranked 406 in popularity among boys.
Justice is ranked 497 in popularity among girls.
If the user enters the name “Walter,” then the program should output:
Walter is ranked 366 in popularity among boys.
Walter is not ranked among the top 1000 girl names
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.