Question
Create a NetBeans Java project named P62_yourname. Write a program that prompts the user to enter a year in the range [2001, 2010], a gender
Create a NetBeans Java project named P62_yourname. Write a program that prompts the user to enter a year in the range [2001, 2010], a gender and a name, then displays the ranking of the name for the selected year and gender. Technical Requirements:
a) The data for this project is to be read from by the program directly from the following URLs (DONT store these files locally): http://www.cs.armstrong.edu/liang/data/babynamesranking2001.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2002.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2003.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2004.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2005.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2006.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2007.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2008.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2009.txt http://www.cs.armstrong.edu/liang/data/babynamesranking2010.txt
b) The data files consist of lines of data, each containing a ranking (an integer), a boy's name (a string), the number of boy's that were given that name (an integer), a girl's name (a string) and the number of girls that where given that name (an integer). Values are separated by spaces and/or tabs, which java.util.Scanner will use as separators by default..
Here is an example of the first 10 lines of one of the files (babynamesranking2002.txt):
1 Jacob 30541 Emily 24450 2 Michael 28220 Madison 21771 3 Joshua 25965 Hannah 18802 4 Matthew 25142 Emma 16520 5 Ethan 22099 Alexis 15629 6 Andrew 21996 Ashley 15335 7 Joseph 21872 Abigail 15292 8 Christopher 21665 Sarah 14741 9 Nicholas 21380 Samantha 14652 10 Daniel 21291 Olivia 14627
c) Using java.util.Scanner to read from a URL: Create a java.net.URL instance object with the URL string, then pass the return of the URL method openStream() to the constructor of Scanner. For example: try (java.util.Scanner input = new java.util.Scanner(new java.net.URL( "http://www.cs.armstrong.edu/liang/data/babynamesranking2010.txt" ).openStream())) {
d) The data is to be stored in two arrays of maps, one for boys names and one for girls names. Each array must have one element for each of the 10 years of data. Each element in the array is a map (a class from the Java API that implements interface Map) that stores key / value pairs, each pair consisting of a name and its ranking, with the name serving as the key.
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