Question: Java Programming: The popularity ranking of baby names from years 2001 to 2010 is downloaded from www.ssa.gov/oact/babynames and stored in files named babynameranking2001.txt, babynameranking2002.txt, .

Java Programming:

The popularity ranking of baby names from years 2001 to 2010 is downloaded from www.ssa.gov/oact/babynames and stored in files named babynameranking2001.txt, babynameranking2002.txt, . . . , babynameranking2010.txt in babynames/data folder.

Each file contains one thousand lines. Each line contains a ranking, a boys name, number for the boys name, a girls name, and number for the girls name. For example, the first two lines in the file babynameranking2010.txt are as follows:

1 Jacob 21,875 Isabella 22,731

So, the boys name Jacob and girls name Isabella are ranked #1 and the boys name Ethan and girls name Sophia are ranked #2. 21,875 boys are named Jacob and 22,731 girls are named Isabella. Complete the programs that prints ranks for the data provided in the file.

Boy name Javier is ranked #190 in year 2010

Girl name Jennifer is ranked #109 in year 2009

Girl name ABC is not ranked in year 2008

Note: the website for the .txt files is listed in the first paragraph.

Skeleton:

package babynames;

import java.io.File; import java.util.Scanner;

public class ReadNames { private static String[][] boyNames = new String[10][1000]; private static String[][] girlNames = new String[10][1000];

public static void getRank(int year, char gender, String name) { readFiles(); // }

private static void readFiles() { //open the files and loads the records to ArrayLists

}

private static int searchBoyNames(int year, String name) { //return ranking if found. If not found, return -1 return -1; }

private static int searchGirlNames(int year, String name) { //return ranking if found. If not found, return -1 return -1; } }

Test Program Skeleton:

package babynames;

import java.util.Scanner;

/** * Created by Tulin on 9/12/2017. */ public class ReadNamesTest { public static void main(String[] args) {

int year = 2010; char gender = 'M'; String name = "Javier"; ReadNames.getRank(year, gender, name);

year = 2009; gender = 'F'; name = "Jennifer"; ReadNames.getRank(year, gender, name);

year = 2008; gender = 'F'; name = "ABC"; ReadNames.getRank(year, gender, name);

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!