The text file boynames.txt and girlnames.txt, which are included in the source code for this book, contain lists of the 1,000 most popular boy and girl names in the United States for the year 2005, as compiled by the SSN. These are blank-delimited where the most popular name is listed first, the second most popular name is listed second, and so on to the 1,000th most popular name, which is listed last. Each line consists of the first name followed by a blank space followed by the number of registered birth in the year using that name. For example, the girlnames.txt file begins with: Emily 25494 Emma 22532 This indicates the Emily is the most popular name with 25,494 registered namings, Emma is the second most popular with 22,532, and so on. Write a program that determines how many names are on both the boy’s and girls’ list. Use the following algorithm: Read each girl name as a String, ignoring the number of namings, and add it to a HashSet object. Read each boy names as a String, ignoring the number of namings, and add it to the same HashSet object. If the name is already in the HashSet, then the add method returns false. If you count the number of false returns, then this gives you the number of common namings Add each common name to an ArrayList and output all of the common names from this list before the program exists.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

The text file boynames.txt and girlnames.txt, which are included in the source code for this book, contain lists of the 1,000 most popular boy and girl names in the United States for the year 2005, as compiled by the SSN.

These are blank-delimited where the most popular name is listed first, the second most popular name is listed second, and so on to the 1,000th most popular name, which is listed last. Each line consists of the first name followed by a blank space followed by the number of registered birth in the year using that name. For example, the girlnames.txt file begins with:

Emily 25494

Emma 22532

This indicates the Emily is the most popular name with 25,494 registered namings, Emma is the second most popular with 22,532, and so on.

Write a program that determines how many names are on both the boy’s and girls’ list. Use the following algorithm:

  • Read each girl name as a String, ignoring the number of namings, and add it to a HashSet object.
  • Read each boy names as a String, ignoring the number of namings, and add it to the same HashSet object. If the name is already in the HashSet, then the add method returns false. If you count the number of false returns, then this gives you the number of common namings
  • Add each common name to an ArrayList and output all of the common names from this list before the program exists.
Emily 23544
Emma 19976
Madison 19240
Abigail 15492
Olivia 15453
Isabella 14908
Hannah 14553
Samantha 13436
Ava 13411
Ashley 13092
Sophia 12458
Elizabeth 12453
Alexis 11770
Grace 11633
Sarah 11263
Alyssa 10726
Mia 10663
Natalie 10579
Chloe 9406
Brianna 9218
Lauren 9098
Ella 8930
Anna 8885
Taylor 8538
Kayla 8483
Hailey 8475
Jessica 7966
Victoria 7812
Jasmine 7713
Sydney 7286
Julia 6968
Destiny 6703
Morgan 6643
Kaitlyn 6423
Savannah 6345
Katherine 6276
Alexandra 6225
Rachel 6077
Transcribed Image Text:Emily 23544 Emma 19976 Madison 19240 Abigail 15492 Olivia 15453 Isabella 14908 Hannah 14553 Samantha 13436 Ava 13411 Ashley 13092 Sophia 12458 Elizabeth 12453 Alexis 11770 Grace 11633 Sarah 11263 Alyssa 10726 Mia 10663 Natalie 10579 Chloe 9406 Brianna 9218 Lauren 9098 Ella 8930 Anna 8885 Taylor 8538 Kayla 8483 Hailey 8475 Jessica 7966 Victoria 7812 Jasmine 7713 Sydney 7286 Julia 6968 Destiny 6703 Morgan 6643 Kaitlyn 6423 Savannah 6345 Katherine 6276 Alexandra 6225 Rachel 6077
þacob 25347
Michael 23324
Joshua 22775
Matthew 21045
Ethan 21039
Andrew 20323
Daniel 19776
Anthony 19016
Christopher 18871
Joseph 18737
William 18695
Alexander 17821
Ryan 17735
David 17712
Nicholas 16772
Tyler 16712
James 15773
John 15458
Jonathan 14180
Nathan 14116
Samuel 13967
Christian 13919
Noah 13623
Dylan 13575
Benjamin 13282
Logan 13258
Brandon 12730
Gabriel 12471
Zachary 12047
Jose 11836
Elijah 11355
Angel 10788
Kevin 10756
Jack 10755
Caleb 10710
Justin 10345
Austin 9963
Evan 9962
Transcribed Image Text:þacob 25347 Michael 23324 Joshua 22775 Matthew 21045 Ethan 21039 Andrew 20323 Daniel 19776 Anthony 19016 Christopher 18871 Joseph 18737 William 18695 Alexander 17821 Ryan 17735 David 17712 Nicholas 16772 Tyler 16712 James 15773 John 15458 Jonathan 14180 Nathan 14116 Samuel 13967 Christian 13919 Noah 13623 Dylan 13575 Benjamin 13282 Logan 13258 Brandon 12730 Gabriel 12471 Zachary 12047 Jose 11836 Elijah 11355 Angel 10788 Kevin 10756 Jack 10755 Caleb 10710 Justin 10345 Austin 9963 Evan 9962
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY