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
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