Question
Project 1: Popular baby names This is an updated and OOP version of Project #1 in Chapter 10. At the bottom of this homework assignment
Project 1: Popular baby names
This is an updated and OOP version of Project #1 in Chapter 10.
At the bottom of this homework assignment are two files named BoyNames2017.txt and GirlNames2017.txt. These files contain the 1,000 most popular boy and girl names in the United States in 2017, as compiled by the Social Security Administration. The files contain one line per name. Each line has a name, a blank, and the number of registered births using that name in 2017. Names are listed in descending order of popularity, so that the most popular name for the year appears at the top of the file.
Create a Java class named NameAndBirths. Each object of this class will represent a single name. The class will define two instance variables, one String containing a name for that NameAndBirths object, and one int containing the number of registered births in 2017 for that name.
Next, write a program that reads the girl and boy files into memory using arrays of 1,000 NameAndBirths objects each (one array for girls, one array for boys). Then prompt the user to input any name. The program should search through both arrays of NameAndBirths objects. If there is a match, then it should output the popularity ranking, the gender, and the number of registered births for that name and gender. The program should also indicate if there is no matching name entry.
For example, if the user enters the name Jordan, then the program might output the following:
Jordan is ranked 356 among girls with 882 registered births. Jordan is ranked 73 among boys with 5,114 registered births. |
If the user enters the name Benjamin, then the program might output the following:
Benjamin is not ranked among the top 1000 girl names. Benjamin is ranked 6 among boys with 13,733 registered births. |
Submit the listings for the class containing main and the NameandBirths class, and a PrintScreen of the output when running your program using at least three names.
(not sure how to link the files, there is not option on here to)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started