Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to write a program in java that does the following. imports a csv file an

ID: 3565231 • Letter: I

Question

I need to write a program in java that does the following. imports a csv file and reads and interprets the following data.

Column1 Column2 Column3

Feature Type 1.5% 05:00 (12 hr clock format)

feature type might have a name like "metal" or "deformation"

Basically I need the program to be able to import the csv file and read the columns and be able use a query to count the number of features within a certain set of parameters.

Let's say for example i want to know how many deformations are above 2% between 8:00 oclock and 4:00 oclock. and have the program output that number.

I need the output to find feature type greater than or equal to or less than a percentage within a certain o'clock orientation. If you could set one of these to

find "Deformations greater than 2% but less than 4% between 8:00 oclock and 4 oclock" then I could manipulate the program to add the parameters I want. I'm stuck on what to do after importing the csv and tieing columns 1,2 and 3 together to write a query in java.

If you can please help me set up the program to be able to read the csv file imported into it with the parameter example i gave and spit out the output to count the amount of items that qualify within those parameters, then i can modify the parameters to suit the my needs. Thank you.Please feel free to ask any questions.

here is an example of final program i want.

import .csv file

Column1 Column2 Column 3

Deformation 1.5% 08:00

Deformation 2.5% 08:35

Deformation 3.2% 09:00

Output

The amount of deformations found greaters than 2% and between 8:00 oclock and 4:00 oclock are 2

Explanation / Answer

import java.io.File; import java.io.FileReader; import java.io.IOException; import java.sql.SQLException; import java.util.HashMap; import java.util.List; import java.util.Map; import au.com.bytecode.opencsv.CSVReader; import com.healthmarketscience.jackcess.Database; import com.healthmarketscience.jackcess.Table; public class newcount { public static class ValueKey{ String mdmId; String pgName; @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mdmId == null) ? 0 : mdmId.hashCode()); result = prime * result + ((pgName == null) ? 0 : pgName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ValueKey other = (ValueKey) obj; if (mdmId == null) { if (other.mdmId != null) return false; } else if (!mdmId.equals(other.mdmId)) return false; if (pgName == null) { if (other.pgName != null) return false; } else if (!pgName.equals(other.pgName)) return false; return true; } public ValueKey(String mdmId, String pgName) { super(); this.mdmId = mdmId; this.pgName = pgName; } } public static void main(String[] args) throws IOException, SQLException,Throwable{ Integer count; String MDMID,NAME,PGNAME,PGTARGET,TEAM; Table RESOURCES = Database.open(new File("C:/STATS/TargetFile.mdb")).getTable("RESOURCES"); int pcount = RESOURCES.getRowCount(); String csvFilename = "C:\MDMSTATS\APEX eport.csv"; CSVReader csvReader = new CSVReader(new FileReader(csvFilename)); List content = csvReader.readAll(); Map csvValuesCount = new HashMap(); for (String[] rowcsv : content) { ValueKey key = new ValueKey(rowcsv[6], rowcsv[1]); count = csvValuesCount.get(key); csvValuesCount.put(key,count == null ? 1: count + 1); } //int count = 0; // Taking 1st resource data for (int i = 0; i