Question
Task (In java) The task is to write a baby name generator program that takes in the name of a CSV file containing the potential
Task (In java)
The task is to write a baby name generator program that takes in the name of a CSV file containing the potential baby names and the gender as command line arguments. (NOT a Scanner input from the terminal).
Then, you should read in the file of baby names and randomly choose 3 names from the list for that gender and write those out to a new file called "potential_names.txt".
To safeguard against malicious input, you should create a custom exception class called IncompatibleExtensionException that is thrown if the file entered as a command line argument does not end with ".csv". If this happens, tell the user your program only works with CSV files.
Sample Output
java BabyNames yob2020.csv M //will write out 3 randomly selected male names from yob2020.csv to "potential_names.txt"
java BabyNames yob2000.csv F //will write out 3 randomly selected female names from yob2000.csv to "potential_names.txt"
java BabyNames yob1980.txt F //will throw an IncompatibleExtensionException and print to the console that only CSVs are accepted
Test Files
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