Question: Write a program that uses the files described in Programming Exercise 12.31 and displays a ranking summary table for the first five girl?s and boy?s

Write a program that uses the files described in Programming Exercise 12.31 and displays a ranking summary table for the first five girl?s and boy?s names as follows:Year Rank 1 Rank 2 Rank 3 Rank 4 Rank 5 RankThe popularity ranking of baby names from years 2001 to 2010 is downloaded fromwww.ssa.gov/oact/babynamesand stored in files namedbabynameranking2001.txt,babynameranking2002.txt, . . . ,babynameranking2010.txt. Each file contains one thousand lines. Each line contains a ranking, a boy?s name, number for the boy?s name, a girl?s name, and number for the girl?s name. For example, the first two lines in the filebabynameranking2010.txtare as follows:

1

Jacob

21,875

Isabella

22,731

2

Ethan

17,866

Sophia

20,477

So, the boy?s name Jacob and girl?s name Isabella are ranked #1 and the boy?s name Ethan and girl?s name Sophia are ranked #2. 21,875 boys are named Jacob and 22,731 girls are named Isabella. Write a program that prompts the user to enter the year, gender, and followed by a name, and displays the ranking of the name for the year. Here is a sample run:

1 Rank 2 Rank 3 Rank 4 Rank 5 Michael Jayden Isabella

Sophia Olivia Ava Ethan William 2010 Emma Jacob 0livia Sophia Ava Michael

Year

Rank 1

Rank 2

Rank 3

Rank 4

Rank 5

Rank 1

Rank 2

Rank 3

Rank 4

Rank 5

2010

Isabella

Sophia

Emma

Olivia

Ava

Jacob

Ethan

Michael

Jayden

William

2009

Isabella

Emma

Olivia

Sophia

Ava

Jacob

Ethan

Michael

Alexander

William

?

2001

Emily

Madison

Hannah

Ashley

Alexis

Jacob

Michael

Matthew

Joshua

Christopher

Year Rank 1 Rank 2 Rank 3 Rank 4 Rank 5 Rank 1 Rank 2 Rank 3 Rank 4 Rank 5 Michael Jayden Isabella Sophia Olivia Ava Ethan William 2010 Emma Jacob 0livia Sophia Ava Michael Isabella Jacob Alexander William 2009 Ethan Emma Madison Hannah Ashley Alexis Jacob Emily Michael Matthew Joshua Christopher 2001 Enter the year: 2010 JEnter Enter the gender: M -Enter Enter the name: Javier Jtnter Javier is ranked #190 in year 2010

Step by Step Solution

3.43 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program Plan Import required packages ArrayList and Scanner Create a class RankingSummary Create three Array Lists for boysgirls and lines Call the me... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!