Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a Baby class that stores the name, rank, and number of babies of that name from the CSV file. You are also required to
Create a Baby class that stores the name, rank, and number of babies of that name from the CSV
file. You are also required to create any necessary methods, constructors associated with this
Bab class.
2. For year 1990, using the data from the 1990 csv file, and create one array that stores all of the
baby boy names in it using the Baby class. For example,
BabyBoy1990 [] = new Baby[1000];
Populate all of the 1000 baby boy information in the above array.
3. Sort the array in step 2 alphabetically of their name, using the .sort() function associate with the
array in step 2. You have to use the Comparable interface as described in chapter 10 to
complete this step. Print out the array.
4. Repeat the above process for baby girls for 1990. That is populate and sort the girl baby array.
Print out the array.
5. Repeat the above steps for all 27 years. That is, you should be 27 arrays of boys and 27 arrays of
girls information, all sorted alphabetically. Print out the array.
6. Create a Total boy arraylist of Baby from the 27 baby boys arrays that sums up all babies with
that name across 27 years. This total array will not be only 1000 but will be more then 1000
elements since there are more than 1000 names now. The arraylist need to be sorted by name
as well. Print out the array.
7. Repeat the same in step 6 for girls. Print out the array.
8. Make sure that you protect your code from getting into FileNotFoundException.
Hint: when you print out the array, the format should look like this.
(need to modify the toString() method).
For example: Baby Name: Rank : Number \n
Michael: 2: 123456
file. You are also required to create any necessary methods, constructors associated with this
Bab class.
2. For year 1990, using the data from the 1990 csv file, and create one array that stores all of the
baby boy names in it using the Baby class. For example,
BabyBoy1990 [] = new Baby[1000];
Populate all of the 1000 baby boy information in the above array.
3. Sort the array in step 2 alphabetically of their name, using the .sort() function associate with the
array in step 2. You have to use the Comparable interface as described in chapter 10 to
complete this step. Print out the array.
4. Repeat the above process for baby girls for 1990. That is populate and sort the girl baby array.
Print out the array.
5. Repeat the above steps for all 27 years. That is, you should be 27 arrays of boys and 27 arrays of
girls information, all sorted alphabetically. Print out the array.
6. Create a Total boy arraylist of Baby from the 27 baby boys arrays that sums up all babies with
that name across 27 years. This total array will not be only 1000 but will be more then 1000
elements since there are more than 1000 names now. The arraylist need to be sorted by name
as well. Print out the array.
7. Repeat the same in step 6 for girls. Print out the array.
8. Make sure that you protect your code from getting into FileNotFoundException.
Hint: when you print out the array, the format should look like this.
(need to modify the toString() method).
For example: Baby Name: Rank : Number \n
Michael: 2: 123456
Step by Step Solution
There are 3 Steps involved in it
Step: 1
import javaioBufferedReader import javaioFileReader import javaioIOException import javautilArrayList import javautilArrays import javautilCollections ...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