Question: Revise Programming Exercise 21.11 to prompt the user to enter year, gender, and name and display the ranking for the name. Prompt the user to

Revise Programming Exercise 21.11 to prompt the user to enter year, gender, and name and display the ranking for the name. Prompt the user to enter another inquiry or exit the program. Here is a sample run:

Enter the year: 2010 -ner Enter the gender: M uener Enter the

Data from Programming Exercise 21.11

Use the data files from Programming Exercise 12.31 to write a program that enables the user to select a year, gender, and enter a name to display the ranking of the name for the selected year and gender, as shown in Figure 21.9. To achieve the best efficiency, create two arrays for boy’s names and girl’s names, respectively. Each array has 10 elements for 10 years. Each element is a map that stores a name and its ranking in a pair with the name as the key.

name: Javier JErte Boy name Javier is ranked #190 in year 2010

Enter the year: 2010 -ner Enter the gender: M uener Enter the name: Javier JErte Boy name Javier is ranked #190 in year 2010 Enter another inquiry? Y Priar Enter the year: 2001 -ener Enter the gender: F -eter Enter the name: Emily -imter Girl name Emily is ranked #1 in year 2001 Enter another inquiry? N Jter

Step by Step Solution

3.46 Rating (175 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautil import javanet public class Exercise2113 private Map mapForBoy new HashMap10 private ... 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 Introduction to Java Programming and Data Structure Questions!