Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MFDBS 89 2nd Symposium On Mathematical Fundamentals Of Database Systems Visegrad Hungary June 26 30 1989 Proceedings

Authors: Janos Demetrovics ,Bernhard Thalheim

1989th Edition

3540512519, 978-3540512516

More Books

Students also viewed these Databases questions

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago