diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..0bb20cb --- /dev/null +++ b/.classpath @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..0f80fd0 --- /dev/null +++ b/.project @@ -0,0 +1,34 @@ + + + coding-competition + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1602383756483 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000..d4313d4 --- /dev/null +++ b/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..ac8e750 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..0b2a5a2 --- /dev/null +++ b/debug.log @@ -0,0 +1 @@ +[1010/231742.885:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) diff --git a/feedback.txt b/feedback.txt index b931d50..8fd2318 100644 --- a/feedback.txt +++ b/feedback.txt @@ -1,9 +1,12 @@ Your team (name of each individual participating): +Joshua Hadden & Scott Hunt How many JUnits were you able to get to pass? +0 JUnits Passed Document and describe any enhancements included to help the judges properly grade your submission. - Step 1: - Step 2: +No Enhancements Feedback for the coding competition? Things you would like to see in future events? + +Very difficult competition due to lack of assistance in setting up programming environment. Simply running JUnit tests got in the way of programming the actual problems. Directions were unclear as to where to begin programming. My team did not see the file with the included comments for how to proceed with passing the tests for the first hour and a half. As senior computer science students, this challenge was also way above our heads and this was a very difficult task that made us feel uncertain about our skills. \ No newline at end of file diff --git a/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java b/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java index 58267da..dff1748 100644 --- a/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java +++ b/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java @@ -10,6 +10,12 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import java.util.ArrayList; +import java.util.List; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MappingIterator; import com.fasterxml.jackson.databind.ObjectReader; @@ -31,8 +37,28 @@ public class CodingCompCsvUtil { */ public List readCsvFile(String filePath, Class classType) { - } - + int count = 0; + List myList = new ArrayList(); + try{ + File file = new File(filePath); + Scanner scanner = new Scanner(file); + + scanner.useDelimiter(","); + + while(scanner.hasNext()) + { + T doc = (T)(scanner.getClass()); + myList.add(doc); + } + scanner.close(); + } + catch (FileNotFoundException fe) + { + fe.printStackTrace(); + } + + return myList; + } /* #2 * getAgentCountInArea() -- Return the number of agents in a given area. diff --git a/src/main/java/sf/codingcompetition2020/structures/Agent.java b/src/main/java/sf/codingcompetition2020/structures/Agent.java index e2e6f93..ca3e62e 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Agent.java +++ b/src/main/java/sf/codingcompetition2020/structures/Agent.java @@ -1,5 +1,9 @@ package sf.codingcompetition2020.structures; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + public class Agent { private int agentId; @@ -7,5 +11,35 @@ public class Agent { private String language; private String firstName; private String lastName; + + public String getFirstName() + { + return this.firstName; + } + + public int getAgentCountInArea(String filepath, String area) + { + int count = 0; + try{ + File file = new File(filepath); + Scanner scanner = new Scanner(file); + + scanner.useDelimiter(","); + + while(scanner.hasNext()) + { + if(scanner.next().equals(area)) + count++; + } + scanner.close(); + } + catch (FileNotFoundException fe) + { + fe.printStackTrace(); + } + + return count; + } + } diff --git a/src/main/java/sf/codingcompetition2020/structures/Claim.java b/src/main/java/sf/codingcompetition2020/structures/Claim.java index 581140a..f264bb0 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Claim.java +++ b/src/main/java/sf/codingcompetition2020/structures/Claim.java @@ -5,5 +5,10 @@ public class Claim { private int customerId; private boolean closed; private int monthsOpen; + + public int getClaimId() + { + return this.claimId; + } } diff --git a/src/main/java/sf/codingcompetition2020/structures/Customer.java b/src/main/java/sf/codingcompetition2020/structures/Customer.java index f151906..cdfd219 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Customer.java +++ b/src/main/java/sf/codingcompetition2020/structures/Customer.java @@ -2,6 +2,9 @@ import java.util.ArrayList; import java.util.List; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; @@ -24,4 +27,32 @@ public class Customer { private short yearsOfService; private Integer vehiclesInsured; + public String getFirstName() + { + return this.firstName; + } + + public int getAgentCountInArea(String filepath, String area) + { + int count = 0; + try{ + File file = new File(filepath); + Scanner scanner = new Scanner(file); + + scanner.useDelimiter(","); + + while(scanner.hasNext()) + { + if(scanner.next().equals(area)) + count++; + } + scanner.close(); + } + catch (FileNotFoundException fe) + { + fe.printStackTrace(); + } + + return count; + } } diff --git a/src/main/java/sf/codingcompetition2020/structures/Vendor.java b/src/main/java/sf/codingcompetition2020/structures/Vendor.java index 6b6fb76..a9d816f 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Vendor.java +++ b/src/main/java/sf/codingcompetition2020/structures/Vendor.java @@ -1,9 +1,37 @@ package sf.codingcompetition2020.structures; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + public class Vendor { private int vendorId; private String area; private int vendorRating; private boolean inScope; + + public int getAgentCountInArea(String filepath, String area) + { + int count = 0; + try{ + File file = new File(filepath); + Scanner scanner = new Scanner(file); + + scanner.useDelimiter(","); + + while(scanner.hasNext()) + { + if(scanner.next().equals(area)) + count++; + } + scanner.close(); + } + catch (FileNotFoundException fe) + { + fe.printStackTrace(); + } + + return count; + } } diff --git a/target/classes/META-INF/MANIFEST.MF b/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index e2a1a34..0000000 --- a/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: yc1d -Build-Jdk: 1.8.0_201 -Created-By: Maven Integration for Eclipse - diff --git a/target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.properties b/target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.properties deleted file mode 100644 index fe569e3..0000000 --- a/target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Thu Oct 08 09:27:33 MST 2020 -version=1.0.0-SNAPSHOT -groupId=sf.codingcompetition2020 -m2e.projectName=coding-competition -m2e.projectLocation=/Users/yc1d/Development/coding-competition/problem/online-competition -artifactId=coding-competition diff --git a/target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.xml b/target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.xml deleted file mode 100644 index 21d55bf..0000000 --- a/target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - coding-competition - 1.0.0-SNAPSHOT - jar - sf.codingcompetition2020 - - coding-competition - Coding Competition - - - - - - - junit - junit - 4.12 - test - - - - com.fasterxml.jackson.dataformat - jackson-dataformat-csv - 2.11.2 - - - - diff --git a/target/classes/sf/codingcompetition2020/CodingCompCsvUtil.class b/target/classes/sf/codingcompetition2020/CodingCompCsvUtil.class index 00daba9..ed7faf8 100644 Binary files a/target/classes/sf/codingcompetition2020/CodingCompCsvUtil.class and b/target/classes/sf/codingcompetition2020/CodingCompCsvUtil.class differ diff --git a/target/classes/sf/codingcompetition2020/structures/Agent.class b/target/classes/sf/codingcompetition2020/structures/Agent.class index 26bf31f..5e1e385 100644 Binary files a/target/classes/sf/codingcompetition2020/structures/Agent.class and b/target/classes/sf/codingcompetition2020/structures/Agent.class differ diff --git a/target/classes/sf/codingcompetition2020/structures/Claim.class b/target/classes/sf/codingcompetition2020/structures/Claim.class index 1ce796d..bd07eb5 100644 Binary files a/target/classes/sf/codingcompetition2020/structures/Claim.class and b/target/classes/sf/codingcompetition2020/structures/Claim.class differ diff --git a/target/classes/sf/codingcompetition2020/structures/Customer.class b/target/classes/sf/codingcompetition2020/structures/Customer.class index 844ea29..0ee11f0 100644 Binary files a/target/classes/sf/codingcompetition2020/structures/Customer.class and b/target/classes/sf/codingcompetition2020/structures/Customer.class differ diff --git a/target/classes/sf/codingcompetition2020/structures/Vendor.class b/target/classes/sf/codingcompetition2020/structures/Vendor.class index fdbca9b..721c8de 100644 Binary files a/target/classes/sf/codingcompetition2020/structures/Vendor.class and b/target/classes/sf/codingcompetition2020/structures/Vendor.class differ diff --git a/target/hamcrest-core-1.3.jar b/target/hamcrest-core-1.3.jar new file mode 100644 index 0000000..9d5fe16 Binary files /dev/null and b/target/hamcrest-core-1.3.jar differ diff --git a/target/junit-4.13.jar b/target/junit-4.13.jar new file mode 100644 index 0000000..acc3c43 Binary files /dev/null and b/target/junit-4.13.jar differ diff --git a/target/test-classes/sf/codingcompetition2020/CodingCompCsvUtilTest.class b/target/test-classes/sf/codingcompetition2020/CodingCompCsvUtilTest.class index 765ac60..f2acf57 100644 Binary files a/target/test-classes/sf/codingcompetition2020/CodingCompCsvUtilTest.class and b/target/test-classes/sf/codingcompetition2020/CodingCompCsvUtilTest.class differ