Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Given popular baby names by sex and ethnic group in 2011-2017

Given popular baby names by sex and ethnic group in 2011-2017

Computer Science

Given popular baby names by sex and ethnic group in 2011-2017. Data were collected through civil birth registration provided by DOHMH available owned by NYC OpenData. Write a Java program that sorting baby names in the descending order of frequency to represent the popularity of a name. Output the popular baby names by year of birth, gender and ethnic group requested by user.

Input:

Input file: “Popular_Baby_Names.csv”.

Data Dictionary:

Year of Birth: Year the baby was born

Sex: Sex of the baby

Ethnicity: Mother's Ethnicity

Baby's First Name: Baby's first names

Count: Number of babies with this name

User is prompted to enter year of birth, gender, and ethnicity in console.

Output:

Output all the baby names by year of birth, gender, ethnic group requested by user in the order of popularity.

For instance,

Popular baby boy name in hispanic in 2017:

Liam, Jacob, Dylan, Matthew, Noah, Sebastian, Jayden, Lucas, Ethan, Aaron, …………

 

Requirements:

No third-party libraries are allowed.

You may add Java code in the main method but do not modify the existed statements in HW4.java file.

You may use BufferedReader, Scanner …… to read the input file. To parse a string, you may refer to the Java StringTokenizer class or String class.

Classes required for the project:

  1. You may use a java built-in structure: ArrayList, LinkedList, Stack, HashMap or TreeMap or the data structures or algorithms we implemented in class to store or sort data. Attach all classes you implement and/or use.
  2. The main method must be in the HW4 class.

 

Your Java program must be submitted on Blackboard as attachmentsNO .class files.

Any submissions that do not compile or work; or classes do not name as required above will receive a 0. Excuses such as “It compiled on my computer” or “It worked last time” will not be accepted. Your program must work on all machines not just yours.

import java.util.Scanner;

public class Hw4 {

	public static void main(String[] args) {
		
		boolean done = false;
		while (!done) {
			System.out.print("Year of Birth(2011-2017, yyyy): ");
			Scanner in = new Scanner(System.in);
			int year = in.nextInt();

			System.out.print("Gender(boy/girl): ");
			in = new Scanner(System.in);
			String gender = in.nextLine();

			System.out.print("Ethnicity(asian/black/hispanic/white): ");
			in = new Scanner(System.in);
			String ethnicity = in.nextLine();

			// closing scanner
			in.close();

			System.out.println("Popular baby " + gender +" names in " + ethnicity + " in " + year +":");
			//add code to print out the popular baby names by year of birth, gender and ethnic group
			
			System.out.print("Interested in more(yes/no): ");
			in = new Scanner(System.in);
			String more = in.nextLine();
			if (more.equalsIgnoreCase("no")) done = true;
		}
	}

}
 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE