The text file babynames.txt, contains a list of the 1000 most popular boy and girl names for the year 2004. This is a space delimited file of 1000 entries in which the rank is listed first, followed...




The text file babynames.txt, contains a list of the 1000 most popular boy and girl names for the year 2004. 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

1 Jacob Emily



2 Michael Emma



3 Joshua Madison



This indicates that Jacob is the 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 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 no 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.



Your program should allow the user to enter names indefinitely but it should also provide an option for the user to quit.





Note: Your main function must consist of only variable declarations and functions calls.






May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here