Question: Write a Java program to load, parse, and filter the data contained in a CSV file for that data set. Your Java code should consist

Write a Java program to load, parse, and filter the data contained in a CSV file for that data set.

Your Java code should consist of a main method (also called the program driver).

The driver will call several static methods that will open the CSV data file, parse a single column from the data contained in the file, and print that column to a new file.

Implement a static method copyColumn(String out, int n) that will read data from column n in the CSV data file, and write it out to a new file whose name is contained in the variable out. Implement a static method filterColumn(String out, int n, ________) that will read data from column n in the CSV data file, filter the data based on a criteria passed as the third argument and write the data to a new file whose name is contained in the variable out.

The third argument will depend on the type of data you are filtering:

If your columns contain numerical data, pass a double parameter called "max" and have your method only copy values from the column that are less than the maximum.

If your columns contain labels or String data, pass a String parameter called "matchThis" and have your method only copy values from the column that contain the String matchThis.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!