Question: Lab in Java The Social Security Administration provides a list of popularity ranking of baby names since 18793. You are provided with a version of
Lab in Java
The Social Security Administration provides a list of popularity ranking of baby names since 18793. You are provided with a version of this list, which has 5870 names of male and female baby names. The list also ranks the top 1000 baby names for each gender for 13 decades starting from 1890.
Each line in the file provides a name, a gender and the ranking of the name for the decades between 1890 to 2010. A ranking of 1 indicates that the name was the most popular, while a ranking of 1000 indicates that the name was the least popular (out of 1000) for its gender. A ranking of 0 represents that the name did not make it the top 1000 for that decade.
For instance, the line below indicates that the name Brianna for a female baby was not ranked in the top 1000 during the decades of 1890 1970. From 1980 to 2010, it ranked 340, 61, 15 and 30 out of 1000, respectively. Thus, the name was most popular during the decade of 1980.
BriannaF 000000 0 0 034061 15 30
The objective is to ask the user for a baby name and gender and display the raking of that name throughout history and to display the decade the name was most popular.
You are to ask the user for a file name to read the data. If the user enters: names.txt, you are to open this file and then read and store its data into corresponding arrays. You can then search these arrays for the desired behavior. The examples below illustrate the expected behavior of your program.
The assignment tests your understanding of exception handlers (try/catch), file input and two- dimensional arrays.
Enter a filename: wrongfile.txt Exception at getFile: wrongfile.txt not found. File I/O error at main()
Enter a filename: names.txt Enter the name to search for: voldermort Enter the gender to search for, M or F: m Name could not be located in given file.
Enter a filename: names.txt Enter the name to search for: mark Enter the gender to search for, M or F: f 1890:0 1900:0 1910:0 1920:0 1930:0 1940:0 1950:0 1960:919 1970:932 1980:0 1990:0 2000:0 2010:0 Name was most popular in the decade of 1960, ranking #919/1000.
Enter a filename: names.txt Enter the name to search for: mark Enter the gender to search for, M or F: m 1890:169 1900:153 1910:200 1920:219 1930:219 1940:149 1950:23 1960:6 1970:9 1980:30 1990:46 2000:79 2010:161 Name was most popular in the decade of 1960, ranking #6/1000.
Here is the link to the Java code:
https://drive.google.com/open?id=0BwuDVy83jWPuMTJkMEMzMFRFUzA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
