From bffd5b02d4e22bd237c15489e7a9d58efd3475ab Mon Sep 17 00:00:00 2001 From: wes Date: Sun, 1 Dec 2019 11:56:20 -0500 Subject: [PATCH 1/3] populate Person class --- .idea/vcs.xml | 6 ++ src/main/java/lambdaslab/Person.java | 93 +++++++++++++++++++ src/main/java/lambdaslab/PersonWareHouse.java | 9 ++ src/test/java/lambdaslab/testPerson.java | 34 +++++++ 4 files changed, 142 insertions(+) create mode 100644 .idea/vcs.xml create mode 100644 src/main/java/lambdaslab/Person.java create mode 100644 src/main/java/lambdaslab/PersonWareHouse.java create mode 100644 src/test/java/lambdaslab/testPerson.java 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/src/main/java/lambdaslab/Person.java b/src/main/java/lambdaslab/Person.java new file mode 100644 index 0000000..a41c030 --- /dev/null +++ b/src/main/java/lambdaslab/Person.java @@ -0,0 +1,93 @@ +package lambdaslab; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +public class Person { + public enum Sex { + MALE, FEMALE; + } + + String name; + LocalDate birthday; + Sex gender; + String emailAddress; + Boolean test = false; + public Person () {} + + public Person (String name, Sex gender, LocalDate birthday, String emailAddress) { + this.name = name; + this.gender = gender; + this.birthday = birthday; + this.emailAddress = emailAddress; + } + + public Person (String name, Sex gender, LocalDate birthday, String emailAddress, Boolean test) { + this(name, gender, birthday, emailAddress); + this.test = test; + } + + public LocalDate getNow() { + return test ? LocalDate.of(2019, 12, 1) : LocalDate.now(); + } + + public Integer getAge() { + return getNow().compareTo(birthday); + } + + + + public String toString() { + return (String.format("\nPerson:\n" + + "\tName:\t\t%s\n" + + "\tSex:\t\t%s\n" + + "\tBirthday:\t%s\n" + + "\tEmail:\t\t%s\n", + this.getName(), this.getGender().name(), + this.getBirthday().format(DateTimeFormatter.ofPattern("MM-dd-yyyy")), + this.getEmailAddress())); + } + + public void printPerson() { + System.out.println(this.toString()); + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public Sex getGender() { + return this.gender; + } + + public void setGender(Sex gender) { + this.gender = gender; + } + + public LocalDate getBirthday() { + return this.birthday; + } + + public void setBirthday(LocalDate date) { + this.birthday = date; + } + + public void setBirthday(Integer year, Integer month, Integer day) { + this.birthday = LocalDate.of(year, month, day); + } + + public String getEmailAddress() { + return this.emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + + +} diff --git a/src/main/java/lambdaslab/PersonWareHouse.java b/src/main/java/lambdaslab/PersonWareHouse.java new file mode 100644 index 0000000..f7e1cd8 --- /dev/null +++ b/src/main/java/lambdaslab/PersonWareHouse.java @@ -0,0 +1,9 @@ +package lambdaslab; + +import java.util.List; + +public class PersonWareHouse { + List roster; + + public PersonWareHouse () {} +} diff --git a/src/test/java/lambdaslab/testPerson.java b/src/test/java/lambdaslab/testPerson.java new file mode 100644 index 0000000..e8a7b23 --- /dev/null +++ b/src/test/java/lambdaslab/testPerson.java @@ -0,0 +1,34 @@ +package lambdaslab; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.time.LocalDate; + +public class testPerson { + Person person; + + @Before + public void setUp() { + person = new Person("Wes", Person.Sex.MALE, LocalDate.of(1997, 8, 5), "wes@jones.com", true); + } + + @Test + public void testGetAge() { + Integer actual = person.getAge(); + Integer expected = 22; + Assert.assertEquals(expected, actual); + } + + @Test + public void testPrintPerson() { + String actual = person.toString(); + String expected = "\nPerson:\n" + + "\tName:\t\tWes\n" + + "\tSex:\t\tMALE\n" + + "\tBirthday:\t08-05-1997\n" + + "\tEmail:\t\twes@jones.com\n"; + Assert.assertEquals(expected, actual); + } +} From 8982295bab40121f0427033e110a54668c696ff1 Mon Sep 17 00:00:00 2001 From: wes Date: Sun, 1 Dec 2019 16:35:06 -0500 Subject: [PATCH 2/3] - --- .idea/Lambdas2-ZCW.iml | 22 + .idea/encodings.xml | 4 + .idea/misc.xml | 9 + .idea/modules.xml | 8 + .idea/workspace.xml | 652 ++++++++++++++++++ src/main/java/lambdaslab/Check.java | 29 + src/main/java/lambdaslab/CheckPerson.java | 5 + src/main/java/lambdaslab/Person.java | 16 + src/main/java/lambdaslab/PersonWareHouse.java | 17 +- src/main/java/lambdaslab/Search.java | 38 + src/test/java/lambdaslab/testSearch.java | 45 ++ .../Lambdas2-ZCW/lambdaslab/Check.class | Bin 0 -> 1363 bytes .../Lambdas2-ZCW/lambdaslab/CheckPerson.class | Bin 0 -> 172 bytes .../Lambdas2-ZCW/lambdaslab/Person$Sex.class | Bin 0 -> 996 bytes .../Lambdas2-ZCW/lambdaslab/Person.class | Bin 0 -> 4386 bytes .../lambdaslab/PersonWareHouse.class | Bin 0 -> 1333 bytes .../Lambdas2-ZCW/lambdaslab/Search.class | Bin 0 -> 4180 bytes .../Lambdas2-ZCW/lambdaslab/testPerson.class | Bin 0 -> 1565 bytes .../Lambdas2-ZCW/lambdaslab/testSearch.class | Bin 0 -> 1946 bytes 19 files changed, 844 insertions(+), 1 deletion(-) create mode 100644 .idea/Lambdas2-ZCW.iml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/workspace.xml create mode 100644 src/main/java/lambdaslab/Check.java create mode 100644 src/main/java/lambdaslab/CheckPerson.java create mode 100644 src/main/java/lambdaslab/Search.java create mode 100644 src/test/java/lambdaslab/testSearch.java create mode 100644 target/production/Lambdas2-ZCW/lambdaslab/Check.class create mode 100644 target/production/Lambdas2-ZCW/lambdaslab/CheckPerson.class create mode 100644 target/production/Lambdas2-ZCW/lambdaslab/Person$Sex.class create mode 100644 target/production/Lambdas2-ZCW/lambdaslab/Person.class create mode 100644 target/production/Lambdas2-ZCW/lambdaslab/PersonWareHouse.class create mode 100644 target/production/Lambdas2-ZCW/lambdaslab/Search.class create mode 100644 target/test/Lambdas2-ZCW/lambdaslab/testPerson.class create mode 100644 target/test/Lambdas2-ZCW/lambdaslab/testSearch.class diff --git a/.idea/Lambdas2-ZCW.iml b/.idea/Lambdas2-ZCW.iml new file mode 100644 index 0000000..401d072 --- /dev/null +++ b/.idea/Lambdas2-ZCW.iml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4f50da6 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e080e35 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..3e2b862 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,652 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + current + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,7 +273,7 @@ - + @@ -297,13 +282,13 @@ - + @@ -312,14 +297,14 @@ - + @@ -329,12 +314,13 @@ - + @@ -344,13 +330,13 @@ - + @@ -360,7 +346,7 @@ @@ -386,7 +372,8 @@