From ffad86aa46463a6d9c90ca5b58c5bf4f871ea72e Mon Sep 17 00:00:00 2001 From: Fiery-Silverbird Date: Sat, 10 Oct 2020 21:47:52 -0500 Subject: [PATCH 1/3] Added getter and setter, working on importing .csv file data into the specific classes --- pom.xml | 14 +- .../CodingCompCsvUtil.java | 62 +++++--- .../structures/Agent.java | 49 ++++++- .../structures/Claim.java | 40 ++++- .../structures/Customer.java | 137 ++++++++++++++++++ .../structures/Dependent.java | 20 +++ .../structures/Vendor.java | 40 ++++- .../CodingCompCsvUtilTest.java | 3 +- target/classes/META-INF/MANIFEST.MF | 5 - .../coding-competition/pom.properties | 7 - .../coding-competition/pom.xml | 32 ---- .../CodingCompCsvUtil.class | Bin 3251 -> 4673 bytes .../structures/Agent.class | Bin 428 -> 1535 bytes .../structures/Claim.class | Bin 397 -> 1215 bytes .../structures/Customer.class | Bin 806 -> 4536 bytes .../structures/Dependent.class | Bin 384 -> 867 bytes .../structures/Vendor.class | Bin 419 -> 1297 bytes .../CodingCompCsvUtilTest.class | Bin 3972 -> 5285 bytes 18 files changed, 340 insertions(+), 69 deletions(-) delete mode 100644 target/classes/META-INF/MANIFEST.MF delete mode 100644 target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.properties delete mode 100644 target/classes/META-INF/maven/sf.codingcompetition2020/coding-competition/pom.xml diff --git a/pom.xml b/pom.xml index 21d55bf..c35e2ff 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,19 @@ 4.0.0 coding-competition 1.0.0-SNAPSHOT - jar + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + jar sf.codingcompetition2020 coding-competition diff --git a/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java b/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java index 58267da..0ea0c55 100644 --- a/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java +++ b/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java @@ -1,11 +1,9 @@ package sf.codingcompetition2020; +import java.io.FileNotFoundException; import java.io.FileReader; import java.io.Reader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -16,21 +14,45 @@ import com.fasterxml.jackson.dataformat.csv.CsvMapper; import com.fasterxml.jackson.dataformat.csv.CsvSchema; -import sf.codingcompetition2020.structures.Agent; -import sf.codingcompetition2020.structures.Claim; -import sf.codingcompetition2020.structures.Customer; -import sf.codingcompetition2020.structures.Vendor; +import sf.codingcompetition2020.structures.*; public class CodingCompCsvUtil { - - /* #1 + + /* #1 * readCsvFile() -- Read in a CSV File and return a list of entries in that file. * @param filePath -- Path to file being read in. * @param classType -- Class of entries being read in. * @return -- List of entries being returned. */ public List readCsvFile(String filePath, Class classType) { - + Scanner reader = new Scanner(filePath); + LinkedList ret = new LinkedList<>(); + reader.nextLine(); + if(filePath.toUpperCase().contains("AGENT")) { + while(reader.hasNextLine()) { + String[] insert = reader.nextLine().split(","); + ret.add((T) new Agent(Integer.parseInt(insert[0]), insert[1], insert[2], insert[3], insert[4])); + } + } + else if(filePath.toUpperCase().contains("CLAIM")) { + while(reader.hasNextLine()) { + String[] insert = reader.nextLine().split(","); + ret.add((T) new Claim(Integer.parseInt(insert[0]), Integer.parseInt(insert[1]), Boolean.parseBoolean(insert[2]), Integer.parseInt(insert[3]))); + } + } + else if(filePath.toUpperCase().contains("CUSTOMER")) { + /*while(reader.hasNextLine()) { + String[] insert = reader.nextLine().split(", "); + ret.add((T) new Customer(Integer.parseInt(insert[0], insert[1], insert[2], Integer.parseInt(insert[3]), insert[4], Integer.parseInt(insert[5]), Short.parseShort(insert[6]), insert[7], + }*/ + } + else if(filePath.toUpperCase().contains("VENDOR")) { + while(reader.hasNextLine()) { + String[] insert = reader.nextLine().split(","); + ret.add((T) new Vendor(Integer.parseInt(insert[0]), insert[1], Integer.parseInt(insert[2]), Boolean.parseBoolean(insert[3]))); + } + } + return ret; } @@ -41,7 +63,7 @@ public List readCsvFile(String filePath, Class classType) { * @return -- The number of agents in a given area */ public int getAgentCountInArea(String filePath,String area) { - + return 0; } @@ -53,7 +75,7 @@ public int getAgentCountInArea(String filePath,String area) { * @return -- The number of agents in a given area */ public List getAgentsInAreaThatSpeakLanguage(String filePath, String area, String language) { - + return null; } @@ -66,7 +88,7 @@ public List getAgentsInAreaThatSpeakLanguage(String filePath, String area * @return -- The number of customers that use a certain agent in a given area. */ public short countCustomersFromAreaThatUseAgent(Map csvFilePaths, String customerArea, String agentFirstName, String agentLastName) { - + return 0; } @@ -77,7 +99,7 @@ public short countCustomersFromAreaThatUseAgent(Map csvFilePaths, * @return -- List of customers retained for a given number of years, in ascending order of policy cost. */ public List getCustomersRetainedForYearsByPlcyCostAsc(String customerFilePath, short yearsOfService) { - + return null; } @@ -88,7 +110,7 @@ public List getCustomersRetainedForYearsByPlcyCostAsc(String customerF * @return -- List of customers who’ve made an inquiry for a policy but have not signed up. */ public List getLeadsForInsurance(String filePath) { - + return null; } @@ -103,7 +125,7 @@ b. Whether that vendor is in scope of the insurance (if inScope == false, return * @return -- List of vendors within a given area, filtered by scope and vendor rating. */ public List getVendorsWithGivenRatingThatAreInScope(String filePath, String area, boolean inScope, int vendorRating) { - + return null; } @@ -117,7 +139,7 @@ public List getVendorsWithGivenRatingThatAreInScope(String filePath, Str * @return -- List of customers filtered by age, number of vehicles insured and the number of dependents. */ public List getUndisclosedDrivers(String filePath, int vehiclesInsured, int dependents) { - + return null; } @@ -130,7 +152,7 @@ public List getUndisclosedDrivers(String filePath, int vehiclesInsured * @return -- Agent ID of agent with the given rank. */ public int getAgentIdGivenRank(String filePath, int agentRank) { - + return 0; } @@ -141,7 +163,7 @@ public int getAgentIdGivenRank(String filePath, int agentRank) { * @return -- List of customers who’ve filed a claim within the last . */ public List getCustomersWithClaims(Map csvFilePaths, short monthsOpen) { - + return null; } } diff --git a/src/main/java/sf/codingcompetition2020/structures/Agent.java b/src/main/java/sf/codingcompetition2020/structures/Agent.java index e2e6f93..b7a719c 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Agent.java +++ b/src/main/java/sf/codingcompetition2020/structures/Agent.java @@ -7,5 +7,52 @@ public class Agent { private String language; private String firstName; private String lastName; - + + public Agent(int agentId, String area, String language, String firstName, String lastName) { + this.agentId = agentId; + this.area = area; + this.language = language; + this.firstName = firstName; + this.lastName = lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getLastName() { + return lastName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getLanguage() { + return language; + } + + public void setArea(String area) { + this.area = area; + } + + public String getArea() { + return area; + } + + public void setAgentId(int agentId) { + this.agentId = agentId; + } + + public int getAgentId() { + return agentId; + } } diff --git a/src/main/java/sf/codingcompetition2020/structures/Claim.java b/src/main/java/sf/codingcompetition2020/structures/Claim.java index 581140a..2cafd9a 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Claim.java +++ b/src/main/java/sf/codingcompetition2020/structures/Claim.java @@ -5,5 +5,43 @@ public class Claim { private int customerId; private boolean closed; private int monthsOpen; - + + public Claim(int claimId, int customerId, boolean closed, int monthsOpen) { + this.claimId = claimId; + this.customerId = customerId; + this.closed = closed; + this.monthsOpen = monthsOpen; + } + + public int getMonthsOpen() { + return monthsOpen; + } + + public void setMonthsOpen(int monthsOpen) { + this.monthsOpen = monthsOpen; + } + + public boolean isClosed() { + return closed; + } + + public void setClosed(boolean closed) { + this.closed = closed; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public int getClaimId() { + return claimId; + } + + public void setClaimId(int claimId) { + this.claimId = claimId; + } } diff --git a/src/main/java/sf/codingcompetition2020/structures/Customer.java b/src/main/java/sf/codingcompetition2020/structures/Customer.java index f151906..19d525f 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Customer.java +++ b/src/main/java/sf/codingcompetition2020/structures/Customer.java @@ -24,4 +24,141 @@ public class Customer { private short yearsOfService; private Integer vehiclesInsured; + public Customer(int customerId, String firstName, String lastName, int age, String area, int agentId, short agentRating, String primaryLanguage, List dependents, boolean homePolicy, boolean autoPolicy, boolean rentersPolicy, String totalMonthlyPremium, short yearsOfService, Integer vehiclesInsured) { + this.customerId = customerId; + this.firstName = firstName; + this.lastName = lastName; + this.age = age; + this.area = area; + this.agentId = agentId; + this.agentRating = agentRating; + this.primaryLanguage = primaryLanguage; + this.dependents = dependents; + this.homePolicy = homePolicy; + this.autoPolicy = autoPolicy; + this.rentersPolicy = rentersPolicy; + this.totalMonthlyPremium = totalMonthlyPremium; + this.yearsOfService = yearsOfService; + this.vehiclesInsured = vehiclesInsured; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public int getAgentId() { + return agentId; + } + + public void setAgentId(int agentId) { + this.agentId = agentId; + } + + public short getAgentRating() { + return agentRating; + } + + public void setAgentRating(short agentRating) { + this.agentRating = agentRating; + } + + public String getPrimaryLanguage() { + return primaryLanguage; + } + + public void setPrimaryLanguage(String primaryLanguage) { + this.primaryLanguage = primaryLanguage; + } + + public List getDependents() { + return dependents; + } + + public void setDependents(List dependents) { + this.dependents = dependents; + } + + public boolean isHomePolicy() { + return homePolicy; + } + + public void setHomePolicy(boolean homePolicy) { + this.homePolicy = homePolicy; + } + + public boolean isAutoPolicy() { + return autoPolicy; + } + + public void setAutoPolicy(boolean autoPolicy) { + this.autoPolicy = autoPolicy; + } + + public boolean isRentersPolicy() { + return rentersPolicy; + } + + public void setRentersPolicy(boolean rentersPolicy) { + this.rentersPolicy = rentersPolicy; + } + + public String getTotalMonthlyPremium() { + return totalMonthlyPremium; + } + + public void setTotalMonthlyPremium(String totalMonthlyPremium) { + this.totalMonthlyPremium = totalMonthlyPremium; + } + + public short getYearsOfService() { + return yearsOfService; + } + + public void setYearsOfService(short yearsOfService) { + this.yearsOfService = yearsOfService; + } + + public Integer getVehiclesInsured() { + return vehiclesInsured; + } + + public void setVehiclesInsured(Integer vehiclesInsured) { + this.vehiclesInsured = vehiclesInsured; + } } diff --git a/src/main/java/sf/codingcompetition2020/structures/Dependent.java b/src/main/java/sf/codingcompetition2020/structures/Dependent.java index d4deb1a..4974f11 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Dependent.java +++ b/src/main/java/sf/codingcompetition2020/structures/Dependent.java @@ -4,4 +4,24 @@ public class Dependent { private String firstName; private String lastName; + public Dependent(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } } diff --git a/src/main/java/sf/codingcompetition2020/structures/Vendor.java b/src/main/java/sf/codingcompetition2020/structures/Vendor.java index 6b6fb76..117b7a4 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Vendor.java +++ b/src/main/java/sf/codingcompetition2020/structures/Vendor.java @@ -5,5 +5,43 @@ public class Vendor { private String area; private int vendorRating; private boolean inScope; - + + public Vendor(int vendorId, String area, int vendorRating, boolean inScope) { + this.vendorId = vendorId; + this.area = area; + this.vendorRating = vendorRating; + this.inScope = inScope; + } + + public int getVendorId() { + return vendorId; + } + + public void setVendorId(int vendorId) { + this.vendorId = vendorId; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public int getVendorRating() { + return vendorRating; + } + + public void setVendorRating(int vendorRating) { + this.vendorRating = vendorRating; + } + + public boolean isInScope() { + return inScope; + } + + public void setInScope(boolean inScope) { + this.inScope = inScope; + } } diff --git a/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java b/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java index c29959f..c506964 100644 --- a/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java +++ b/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java @@ -2,6 +2,7 @@ import static org.junit.Assert.assertEquals; +import java.io.FileNotFoundException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,7 +28,7 @@ public class CodingCompCsvUtilTest{ //#1 @Test - public void test1() { + public void test1() throws NoSuchFieldException { assertEquals("Giacopo",((Agent)codingCompCsVUtil.readCsvFile(agentFilePath, Agent.class).get(1)).getFirstName()); assertEquals(424, ((Claim)codingCompCsVUtil.readCsvFile(claimFilePath, Claim.class).get(423)).getClaimId()); assertEquals("Lorin", ((Customer)codingCompCsVUtil.readCsvFile(customerFilePath, Customer.class).get(499)).getFirstName()); 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 00daba9d49249e6950fa6b4b75732ac294bb504b..2c6ef6b47bd673d1d72cc1bc7838b6935fa870bf 100644 GIT binary patch literal 4673 zcmb_fTW=f375kh zdUvT>=_P5}r1vzv0zn@OBrknvA1W0!P@oS5g1iR(8SP_%0&UZ8W|q=Qq+G(N1afE2 z%zWpZ@0>Y%_~C#4_$L6*;g?x_0#y?tiv*TTEN78IRZePIIJlj`ihS0kWHkdLO$+NBcg5^7M9tl%n%?S*gEd@&>wpVrBW!qbAh|mcg z&mBECdTxYplolv01Z(r5Qy(|b=L@UK>9iw(&kvVwTWi)x-Ex;l%AwEg<1tC0ZUw=3 zUQ3z;7%4eHNR%GO4TK*W7`PeR9swB0ED`;h71pHbZ3+zZ+7h_3-k=EwV;i(S!b>BC zPxzSXvTeDp@TooN3#uNBt&y=6QH_in+{qTTM2tlzl(S0JM5Qu5Nx&l=p<1i^%AsYi zT(ueshN;1W^dgVb~rxS1-V+sZiZW$2bM)RwJhAQ;5FT_ z=uVLr1E=nf8$}^sWI|c$z_Augpdl(XD=asJwNhf(o7OTtc)2Ugn2#+jJD5|sk&*mr z)aL&Qbz<)v4?@3b%P0gRiYXP(ht&;wIN>H*|^Yc3qCfe1u zOJpLu5#cSLx;)qp){R7Zo@Z)p@jNF&i>0eN?fHws@`H=(*Xs6q!3)Bvz&3EALpGFm zr#_u{s702nQM!ukUzd2ZOJ(7&IW`G1sC&K}yzWw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z6Ij3(Spa8X`8+JbSppZDT(ED_{vlIsdYCW*D@_^EWS=T-??;0RrpGmbJI(xxDg@3c zMq?DX%Psi9MsuRCWfZ1WnHs4lRO?DskUoD04wmOwf_o%RgZF8r%PRCcDhWMx=e*> zh#hp2z)er|lp7;YON}DDOJHw~(z!4Jfp9EJ4+XV*)U*bSzGz~{rL>Fn`6`z}kLKC3 zr*lG8U){6Xs5G*TrOTPw*dRr?O5o`nt;?#O(Q9bodSvTa$2O6Dru43oeOp@VWJj|s zY+_Yy`ty@-ljx)_wb{`Tf$N^eX?fO_PM)}Y-7}V!HPCGW2XnL_YoPH5Y!6*V zFPgZpYRtbObgHO`aOz$2q~poDog?gjCyh%JirQx)mP$Y6ruQX3X5tC1m7;5V8+*JV zT9F)}&PN^rvpsmw@Mu3e<*WJf8OqN}_%VU+=Uu`f-WG5bz3PaV>nM?$#g7%5rSR{1 z!;@aa=fi%kz)RrYd5?eaYI)X6mlp3cyvsT@&uc0M6kR?w0Vlgm+~;6Fe{8dI`l} z@S*?#9_?d*D;NxLei(q~*YJ+O>u>?1F5-0o-pC;L5pChYZ?N)g5d`y+cgA%#<< zz>(g9w~=RM{FCsGhj80Vcn{upT0U^31*awSkREzT>+qo?U2~*GN4oAIJ@%4r!iFQ2 z9BJYYIz8jho|kk7K60eHj#O}(e53;}sSKNrbkC6{*=>0=aWCmUJaD8>9BJaXPty-x g(nENZyZS$Q37^8Y(^7F-{@dxFy`(C7T7b{~2FpNm>;M1& diff --git a/target/classes/sf/codingcompetition2020/structures/Agent.class b/target/classes/sf/codingcompetition2020/structures/Agent.class index 26bf31f236fb6fb54997543cc9d682faad0ab137..556e8ccddc7034ccced06c8a29a3d578fd0a5c3c 100644 GIT binary patch literal 1535 zcmbW0-)<675XR@g@^4w&N}-CaEoiID0$tM7#6&~Vm^2|F^`eIR1-7^iEM|A{Nqh`1 zG?AEi;REjX_fZN0Uw@P8+j4yfLY`^dE2c3k^vGV0piJF7dyNv=KaS;LOyIlP}8D#3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competition2020/structures/Dependent.class index 3ee505f7dda4d5aad7c64d98dd9748ea80a0698b..230789636da5892605a3b34f5390349d7d9f322b 100644 GIT binary patch literal 867 zcmb7?&raJw5XQfC{*lCx5C|<45S*H%6eGk9#HAIdh#sgSadey|EK2Oi-tb%?6(Mox z1N5N~-)=$zO?s#-?e5IZeDj-G|9O7;4d4jd1!V9sk2KcJvXR5595w~=S1L~Qx!;!p zmFA6q>w7&v?0OeER$=#8V4>%~-e*r#sPw78=h|%Ktf$@*NPmkuR4z4DD9?xewv2!J z?Vha_1%9vP$I94aXIfvYM8In%S6&cx2oOa5fz(Q?C_FqkJn#}74+A}nW#WC80~vN? zs0rzIr9PWBvRbRp;xHvAkUQPVQGS}ZwBWgk1ZEj zCsW8_fijlIWjyZYF4Oo0 z=Z*&lMm%esi&oGb1&jsxXJLgN!+6SQ$3$DcDO$mLm)TLpDy)s7CP>*alECU*kksEG d)wv+m`5ff$?3=9m048rUTOp~h_4aC?PSQr@uvJ%S@^>Y&Q()In5vQm>vCd!+O zGHYmtF*2|?=clA{F)%am@Gx*Na87JZnjF9=lgyyVzz7s%U|<45Rt7dOiycfe0%d?I vfg~4DR3At)0%=yQ?F`%-!OD1nBpX@hi diff --git a/target/classes/sf/codingcompetition2020/structures/Vendor.class b/target/classes/sf/codingcompetition2020/structures/Vendor.class index fdbca9b6e0183e880547b8ff174552c31967ec4f..fd6a7a1d3a93b305e1a1908445444b5d640e5db8 100644 GIT binary patch literal 1297 zcma))O>fgc5Qb+HCvFncv}qG4C4~Ylj+@3+)f=c1LPD|>fkdhtdUG5TT%~qpJ3aG* zIDkZi#DO2ck3zh&cG8d!iOcTn?0h`)?*9Js^A{1FQL9KQ9Tq50FL=>;Y4BpGbfi*K z(Aur*_k+;t3lf$f#SUFtP^Eok-`eKT_6KGs4n2SHQjnH}ez0Sl1*x9jae^BciI;-% zuRPz2&jmfut;J;Pve8BHH$fla<+kU$??%@>H@vWWLwG9fz_Ev2JM{RRI+gg77YS;% zqmQN&^wHA^u5aAfi@m@}8>J1E4ie`O^ZZV9C zz}IrvZN0Hbi~wXM0abnRo=cRcy(XHJr=2FAf)`m6oj?PniinxI6kRG)>;$9Gao>8Z zMk(QM@e^oNrelrPsGw1iN*ZZw-J^9u#{cUgXyfiZ-}kOuCzjfDX&-+<#aB@%!%bji zxR2b?O77@}y+9b4Hn48u^citE><^6}B#hlLWsK&SvPOMOicwX@l=~)gD;$F!oUfpA z0kzjL#1>}QfwhI3v!oJjQxzwUXA&VTX30p4X|mE{9tHO`x}VaR*f~CDe5cG87#ZTm zdFkAgO|&E+ZGvx#_Q@#ch~^e~ImR7!QF^O@tH}zrBx;J8Pca36chg$4Ala{TAUjJz z9#MS(e=Dx%CQvcDAM@p46!d5{Bu9IgQ2M`DmC_*jX$vx?;A iK^jXzp3<{4`Jbnm`BBN!90R1a0)+nvgFKgSaPSx2G`ST3 delta 180 zcmXYpI}XA?373yxa&r3qc5GU+xU$43ga}Ja uqREod3BCLGjGo-6bSVyG+u#sa4~A`6ABl-#^l&WZVUC$Fl^IIWGW!AcL=jK` diff --git a/target/test-classes/sf/codingcompetition2020/CodingCompCsvUtilTest.class b/target/test-classes/sf/codingcompetition2020/CodingCompCsvUtilTest.class index 765ac60fa2a1b12f484db96055457db1849af952..4f7a49c4b3cafb836d67669a97e4060f9bb218df 100644 GIT binary patch literal 5285 zcmb7H33wD|8Ga|(><*hDgkebw#g@iElikX41@Zu;4S_&#fsjBVl-g(549SqqY?zsi zq*}Gudeqhy@xHYx^%iXc6s`5vdRw(#^{Dr4TNTefzW*FM6O!w%6Of4zh1^0#QTjh-Xz{{mN6{eZ;^3Cyx%Ir67RPq z@b)BXaY7L9knzq0-j%>Tg7xldya(@1Vm?kLaWCFiMQi+%?oHtRNi4z#1owk7K9sUc`C*u=B(I*35T*d=3J|*M9BtDJLh{tDzz~=&iIl-Ou(apYMgfYuClrwBc!Yuc^w^o9)9yvE(?4!}P;?QuL-Luy*3KFi)*@v-diS1w<@Gho;fmOl-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6Ivt3zbBu!;D`SJu06wI From 7a40a95a1b2112b049619c866208ddcfee970bb7 Mon Sep 17 00:00:00 2001 From: Fiery-Silverbird Date: Sat, 10 Oct 2020 22:26:54 -0500 Subject: [PATCH 2/3] Passed test 1 and test 2 --- .idea/.gitignore | 2 ++ .idea/.name | 1 + .idea/compiler.xml | 16 ++++++++++++++ ...ackson_core_jackson_annotations_2_11_2.xml | 13 ++++++++++++ ...erxml_jackson_core_jackson_core_2_11_2.xml | 13 ++++++++++++ ...l_jackson_core_jackson_databind_2_11_2.xml | 13 ++++++++++++ ...taformat_jackson_dataformat_csv_2_11_2.xml | 13 ++++++++++++ .idea/libraries/Maven__junit_junit_4_12.xml | 13 ++++++++++++ .../Maven__org_hamcrest_hamcrest_core_1_3.xml | 13 ++++++++++++ .idea/misc.xml | 11 ++++++++++ .idea/modules.xml | 8 +++++++ .idea/vcs.xml | 6 ++++++ coding-competition.iml | 21 +++++++++++++++++++ 13 files changed, 143 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_11_2.xml create mode 100644 .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_11_2.xml create mode 100644 .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_11_2.xml create mode 100644 .idea/libraries/Maven__com_fasterxml_jackson_dataformat_jackson_dataformat_csv_2_11_2.xml create mode 100644 .idea/libraries/Maven__junit_junit_4_12.xml create mode 100644 .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 coding-competition.iml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e7e9d11 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..0938c55 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +coding-competition \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..637e8db --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_11_2.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_11_2.xml new file mode 100644 index 0000000..6447563 --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_11_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_11_2.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_11_2.xml new file mode 100644 index 0000000..4923956 --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_11_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_11_2.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_11_2.xml new file mode 100644 index 0000000..bb59715 --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_11_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_dataformat_jackson_dataformat_csv_2_11_2.xml b/.idea/libraries/Maven__com_fasterxml_jackson_dataformat_jackson_dataformat_csv_2_11_2.xml new file mode 100644 index 0000000..c5892a6 --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_jackson_dataformat_jackson_dataformat_csv_2_11_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__junit_junit_4_12.xml b/.idea/libraries/Maven__junit_junit_4_12.xml new file mode 100644 index 0000000..d411041 --- /dev/null +++ b/.idea/libraries/Maven__junit_junit_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..f58bbc1 --- /dev/null +++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d1eecca --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ea60d1f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/coding-competition.iml b/coding-competition.iml new file mode 100644 index 0000000..de540df --- /dev/null +++ b/coding-competition.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From e5cbde7a8c52feaaf77c5fbfbcecf0e93e2b64c0 Mon Sep 17 00:00:00 2001 From: Fiery-Silverbird Date: Sat, 10 Oct 2020 23:54:31 -0500 Subject: [PATCH 3/3] Passed 4 tests --- .../CodingCompCsvUtil.java | 90 ++++++++++++++---- .../structures/Customer.java | 4 + .../CodingCompCsvUtilTest.java | 3 +- .../CodingCompCsvUtil.class | Bin 4673 -> 7459 bytes .../structures/Customer.class | Bin 4536 -> 4601 bytes .../CodingCompCsvUtilTest.class | Bin 5285 -> 5226 bytes 6 files changed, 76 insertions(+), 21 deletions(-) diff --git a/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java b/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java index 0ea0c55..c76d319 100644 --- a/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java +++ b/src/main/java/sf/codingcompetition2020/CodingCompCsvUtil.java @@ -1,8 +1,7 @@ package sf.codingcompetition2020; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.Reader; +import java.io.*; +import java.nio.file.Files; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicInteger; @@ -25,30 +24,45 @@ public class CodingCompCsvUtil { * @return -- List of entries being returned. */ public List readCsvFile(String filePath, Class classType) { - Scanner reader = new Scanner(filePath); + String[] reader = new String[0]; + try { + reader = Files.readAllLines(new File(filePath).toPath()).toArray(new String[0]); + } catch (IOException e) { + e.printStackTrace(); + } LinkedList ret = new LinkedList<>(); - reader.nextLine(); if(filePath.toUpperCase().contains("AGENT")) { - while(reader.hasNextLine()) { - String[] insert = reader.nextLine().split(","); + for(int i = 1; i < reader.length; i++) { + String[] insert = reader[i].split(","); ret.add((T) new Agent(Integer.parseInt(insert[0]), insert[1], insert[2], insert[3], insert[4])); } } else if(filePath.toUpperCase().contains("CLAIM")) { - while(reader.hasNextLine()) { - String[] insert = reader.nextLine().split(","); + for(int i = 1; i < reader.length; i++) { + String[] insert = reader[i].split(","); ret.add((T) new Claim(Integer.parseInt(insert[0]), Integer.parseInt(insert[1]), Boolean.parseBoolean(insert[2]), Integer.parseInt(insert[3]))); } } else if(filePath.toUpperCase().contains("CUSTOMER")) { - /*while(reader.hasNextLine()) { - String[] insert = reader.nextLine().split(", "); - ret.add((T) new Customer(Integer.parseInt(insert[0], insert[1], insert[2], Integer.parseInt(insert[3]), insert[4], Integer.parseInt(insert[5]), Short.parseShort(insert[6]), insert[7], - }*/ + for(int i = 1; i < reader.length; i++) { + String[] insert = reader[i].split(","); + Customer add = new Customer(); + add.setCustomerId(Integer.parseInt(insert[0])); + add.setFirstName(insert[1]); + add.setLastName(insert[2]); + add.setAge(Integer.parseInt(insert[3])); + add.setArea(insert[4]); + add.setAgentId(Integer.parseInt(insert[5])); + add.setAgentRating(Short.parseShort(insert[6])); + add.setPrimaryLanguage(insert[7]); + /*LinkedList put = new LinkedList<>(); + String[] dependents = reader[i].split(", ");*/ + ret.add((T) add); + } } else if(filePath.toUpperCase().contains("VENDOR")) { - while(reader.hasNextLine()) { - String[] insert = reader.nextLine().split(","); + for(int i = 1; i < reader.length; i++) { + String[] insert = reader[i].split(","); ret.add((T) new Vendor(Integer.parseInt(insert[0]), insert[1], Integer.parseInt(insert[2]), Boolean.parseBoolean(insert[3]))); } } @@ -62,8 +76,15 @@ else if(filePath.toUpperCase().contains("VENDOR")) { * @param area -- The area from which the agents should be counted. * @return -- The number of agents in a given area */ - public int getAgentCountInArea(String filePath,String area) { - return 0; + public int getAgentCountInArea(String filePath, String area) { + LinkedList counter = (LinkedList) readCsvFile(filePath, Agent.class); + int ret = 0; + for(int i = 0; i < counter.size(); i++) { + if(counter.get(i).getArea().equals(area)) { + ret++; + } + } + return ret; } @@ -75,7 +96,14 @@ public int getAgentCountInArea(String filePath,String area) { * @return -- The number of agents in a given area */ public List getAgentsInAreaThatSpeakLanguage(String filePath, String area, String language) { - return null; + LinkedList matcher = (LinkedList) readCsvFile(filePath, Agent.class); + LinkedList ret = new LinkedList<>(); + for(int i = 0; i < matcher.size(); i++) { + if(matcher.get(i).getArea().equals(area) && matcher.get(i).getLanguage().equals(language)) { + ret.add(matcher.get(i)); + } + } + return ret; } @@ -88,7 +116,20 @@ public List getAgentsInAreaThatSpeakLanguage(String filePath, String area * @return -- The number of customers that use a certain agent in a given area. */ public short countCustomersFromAreaThatUseAgent(Map csvFilePaths, String customerArea, String agentFirstName, String agentLastName) { - return 0; + LinkedList agents = (LinkedList) readCsvFile(csvFilePaths.get("agentList"), Agent.class); + LinkedList customers = (LinkedList) readCsvFile(csvFilePaths.get("customerList"), Customer.class); + short ret = 0; + for(int i = 0; i < customers.size(); i++) { + if(customers.get(i).getArea().equals(customerArea)) { + for(int j = 0; j < agents.size(); j++) { + Agent comparator = agents.get(j); + if(comparator.getFirstName().equals(agentFirstName) && comparator.getLastName().equals(agentLastName) && comparator.getAgentId() == customers.get(i).getAgentId()) { + ret++; + } + } + } + } + return ret; } @@ -99,6 +140,7 @@ public short countCustomersFromAreaThatUseAgent(Map csvFilePaths, * @return -- List of customers retained for a given number of years, in ascending order of policy cost. */ public List getCustomersRetainedForYearsByPlcyCostAsc(String customerFilePath, short yearsOfService) { + LinkedList match = (LinkedList) readCsvFile(customerFilePath, Customer.class); return null; } @@ -110,7 +152,15 @@ public List getCustomersRetainedForYearsByPlcyCostAsc(String customerF * @return -- List of customers who’ve made an inquiry for a policy but have not signed up. */ public List getLeadsForInsurance(String filePath) { - return null; + LinkedList match = (LinkedList) readCsvFile(filePath, Customer.class); + LinkedList ret = new LinkedList<>(); + for(int i = 0; i < match.size(); i++) { + Customer temp = match.get(i); + if(!temp.isAutoPolicy() && !temp.isHomePolicy() && !temp.isRentersPolicy()) { + ret.add(temp); + } + } + return ret; } diff --git a/src/main/java/sf/codingcompetition2020/structures/Customer.java b/src/main/java/sf/codingcompetition2020/structures/Customer.java index 19d525f..848be76 100644 --- a/src/main/java/sf/codingcompetition2020/structures/Customer.java +++ b/src/main/java/sf/codingcompetition2020/structures/Customer.java @@ -42,6 +42,10 @@ public Customer(int customerId, String firstName, String lastName, int age, Stri this.vehiclesInsured = vehiclesInsured; } + public Customer() { + + } + public int getCustomerId() { return customerId; } diff --git a/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java b/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java index c506964..92c7a39 100644 --- a/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java +++ b/src/test/java/sf/codingcompetition2020/CodingCompCsvUtilTest.java @@ -3,6 +3,7 @@ import static org.junit.Assert.assertEquals; import java.io.FileNotFoundException; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +29,7 @@ public class CodingCompCsvUtilTest{ //#1 @Test - public void test1() throws NoSuchFieldException { + public void test1() { assertEquals("Giacopo",((Agent)codingCompCsVUtil.readCsvFile(agentFilePath, Agent.class).get(1)).getFirstName()); assertEquals(424, ((Claim)codingCompCsVUtil.readCsvFile(claimFilePath, Claim.class).get(423)).getClaimId()); assertEquals("Lorin", ((Customer)codingCompCsVUtil.readCsvFile(customerFilePath, Customer.class).get(499)).getFirstName()); diff --git a/target/classes/sf/codingcompetition2020/CodingCompCsvUtil.class b/target/classes/sf/codingcompetition2020/CodingCompCsvUtil.class index 2c6ef6b47bd673d1d72cc1bc7838b6935fa870bf..641ef17985e2f278e415a69d3498b37515546bdf 100644 GIT binary patch literal 7459 zcmb_h33yyp75?vRZ!&pF+q4rp4NEOs(k&&>2uT}A(-u|ST1J@e3E`czvm*&$6?80X%aRY8N&}HDW2~=RWfzKsS ziE9!F;q!6aB+oCzakD&cG4RC%zJyy7sKISA?e;jnY~YRrzJk#N4#1u`?lf>$0(GLH z4tGnlSDLR%bB{FlO7pb@?!(umcfT~>h~t~G!vhs~5Dz8rFuoPXBL*H#U>?4mKpVaz z+kID>$7J{K$?We-?+0-_UWq60!#I8g>?TI)^mZOm@7dwol5$Ge{TeE0h+wCA+a zB|SZ@ZA4gCR#kDdDqXNL+g4jcT8$SMP{acpTwA+n%y`XF5-6CczMT^-pD1ZaDX?+PxN;3up{t!f4@TUhDj-9ooD$T(JML6=p0kLh=+swggG zUlHiy@v4_hG-skja&To}9jmFI&XWsEF$^T7fu|L+J}HWRpCpKhz$PP+=rk}9iXhze zcERFt(7Q61-(*{PciG6=fy_up&MmaN8HK~kFgCq^;?p5hi;k7L@0HE!5z)71OWMwF zcQTAhRObQf&SZ4HVP7iDpj}<8x-M<$%(}yQD=XU`R%W|07DNj6;E+PkBxb(}Y)2B? zMmyV^%eyB#h5i$r?RIv(Rp5CjNk|%ZX49FR945z>0WdMLr*xJv!ElO7)G167Zo&P$ zT@<#wNxhRZ*0W95*(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