Edit question 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: 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. The main method must be in the HW4 class. You can download the Excel File here(Please copy paste it): ->>> https://data.cityofnewyork.us/Health/Popular-Baby-Names/25th-nujf Main.java 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(); 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; else done = false; } } }
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:
- 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. - The main method must be in the HW4 class.
You can download the Excel File here(Please copy paste it): ->>> https://data.cityofnewyork.us/Health/Popular-Baby-Names/25th-nujf
Main.java
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(); 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; else done = false; } } }Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images