diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..26d33521
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 00000000..325625e7
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 00000000..63e90019
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 00000000..712ab9d9
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 00000000..d4110417
--- /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 00000000..f58bbc11
--- /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 00000000..17e19eb4
--- /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 00000000..711b3a53
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 00000000..e96534fb
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/interfaces-1.iml b/interfaces-1.iml
new file mode 100644
index 00000000..3c40a7ee
--- /dev/null
+++ b/interfaces-1.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f0effe12..65b44a67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,6 +5,18 @@
io.zipcoder
interfaces-1
0.0.1-SNAPSHOT
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 11
+
+
+
+
jar
interfaces-1
diff --git a/src/main/java/io/zipcoder/interfaces/Educator.java b/src/main/java/io/zipcoder/interfaces/Educator.java
new file mode 100644
index 00000000..b077e3c0
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Educator.java
@@ -0,0 +1,28 @@
+package io.zipcoder.interfaces;
+
+public enum Educator implements Teacher{
+ DOLIO( new Instructor(1l, "Dolio")),
+ LEON(new Instructor(2l, "Leon")),
+ OTHERDOLIO(new Instructor(3l, "OtherDolio"));
+
+
+ final Instructor instructor;
+ double timeWorked;
+
+ Educator(Instructor instructor) {
+ this.instructor = instructor;
+ Instructors.getInstance().add(instructor);
+ }
+
+ @Override
+ public void teach(Learner learner, double numberOfHours) {
+ this.instructor.teach(learner, numberOfHours);
+ this.timeWorked += numberOfHours;
+ }
+
+ @Override
+ public void lecture(Learner[] learners, double numberOfHours) {
+ this.instructor.lecture(learners, numberOfHours);
+ this.timeWorked += numberOfHours;
+ }
+}
diff --git a/src/main/java/io/zipcoder/interfaces/Instructor.java b/src/main/java/io/zipcoder/interfaces/Instructor.java
new file mode 100644
index 00000000..771d36fa
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Instructor.java
@@ -0,0 +1,21 @@
+package io.zipcoder.interfaces;
+
+public class Instructor extends Person implements Teacher{
+
+ public Instructor(Long id, String name) {
+ super(id, name);
+ }
+
+ @Override
+ public void teach(Learner learner, double numberOfHours) {
+ learner.learn(numberOfHours);
+ }
+
+ @Override
+ public void lecture(Learner[] learners, double numberOfHours) {
+ double numberOfHoursPerLearner = numberOfHours/ learners.length;
+ for(Learner element : learners){
+ element.learn(numberOfHoursPerLearner);
+ }
+ }
+}
diff --git a/src/main/java/io/zipcoder/interfaces/Instructors.java b/src/main/java/io/zipcoder/interfaces/Instructors.java
new file mode 100644
index 00000000..b45fc587
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Instructors.java
@@ -0,0 +1,21 @@
+package io.zipcoder.interfaces;
+
+public final class Instructors extends People{
+ private static final Instructors INSTANCE = new Instructors();
+
+ private Instructors(){
+ this.add(new Instructor(1l,"Dolio"));
+ this.add(new Instructor(2l,"Leon"));
+ this.add(new Instructor(3l,"Other Dolio"));
+ }
+
+
+ public static Instructors getInstance(){
+ return INSTANCE;
+ }
+
+ @Override
+ public Instructor[] toArray() {
+ return new Instructor[0];
+ }
+}
diff --git a/src/main/java/io/zipcoder/interfaces/Learner.java b/src/main/java/io/zipcoder/interfaces/Learner.java
new file mode 100644
index 00000000..c3d7dc51
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Learner.java
@@ -0,0 +1,6 @@
+package io.zipcoder.interfaces;
+
+public interface Learner {
+ void learn(double numberOfHours);
+ Double getTotalStudyTime();
+}
diff --git a/src/main/java/io/zipcoder/interfaces/People.java b/src/main/java/io/zipcoder/interfaces/People.java
new file mode 100644
index 00000000..ec4970f3
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/People.java
@@ -0,0 +1,45 @@
+package io.zipcoder.interfaces;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public abstract class People implements Iterable{
+ List personList = new ArrayList<>();
+
+ public void add(E person){
+ personList.add(person);
+ }
+
+ public E findById(Long id){
+ for(E element : personList){
+ if(element.getId() == id){
+ return element;
+ }
+ }
+ return null;
+ }
+
+ public Boolean contains(E person){
+ return personList.contains(person);
+ }
+
+ public Boolean remove(E person){
+ return personList.remove(person);
+ }
+
+ public void removeAll(){
+ personList.clear();
+ }
+
+ public Integer count(){
+ return personList.size();
+ }
+
+ public abstract E[] toArray();
+
+ @Override
+ public Iterator iterator() {
+ return personList.iterator();
+ }
+}
diff --git a/src/main/java/io/zipcoder/interfaces/Person.java b/src/main/java/io/zipcoder/interfaces/Person.java
index fc6a3ffe..88bb964c 100644
--- a/src/main/java/io/zipcoder/interfaces/Person.java
+++ b/src/main/java/io/zipcoder/interfaces/Person.java
@@ -1,5 +1,23 @@
package io.zipcoder.interfaces;
-public class Person {
+public class Person {
+ private final Long id;
+ private String name;
+ public Person(Long id, String name){
+ this.id = id;
+ this.name = name;
+ }
+
+ public Long getId(){
+ return this.id;
+ }
+
+ public String getName(){
+ return this.name;
+ }
+
+ public void setName(String name){
+ this.name = name;
+ }
}
diff --git a/src/main/java/io/zipcoder/interfaces/Student.java b/src/main/java/io/zipcoder/interfaces/Student.java
new file mode 100644
index 00000000..ccfa5967
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Student.java
@@ -0,0 +1,21 @@
+package io.zipcoder.interfaces;
+
+public class Student extends Person implements Learner{
+ private double totalStudyTime;
+
+ public Student(Long id, String name) {
+ super(id, name);
+ }
+
+ @Override
+ public void learn(double numberOfHours) {
+ this.totalStudyTime += numberOfHours;
+ }
+
+ @Override
+ public Double getTotalStudyTime() {
+ return totalStudyTime;
+ }
+
+
+}
diff --git a/src/main/java/io/zipcoder/interfaces/Students.java b/src/main/java/io/zipcoder/interfaces/Students.java
new file mode 100644
index 00000000..1bba0d31
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Students.java
@@ -0,0 +1,23 @@
+package io.zipcoder.interfaces;
+
+public final class Students extends People {
+ private static final Students INSTANCE = new Students();
+
+ private Students(){
+ this.add(new Student(1l,"Nick"));
+ this.add(new Student(2l, "Jeremy"));
+ this.add(new Student(3l, "Zach"));
+ this.add(new Student(4l, "Jen"));
+ this.add(new Student(5l, "Nathan"));
+ }
+
+
+ public static Students getInstance(){
+ return INSTANCE;
+ }
+
+ @Override
+ public Student[] toArray() {
+ return new Student[0];
+ }
+}
diff --git a/src/main/java/io/zipcoder/interfaces/Teacher.java b/src/main/java/io/zipcoder/interfaces/Teacher.java
new file mode 100644
index 00000000..66bb58a3
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Teacher.java
@@ -0,0 +1,6 @@
+package io.zipcoder.interfaces;
+
+public interface Teacher {
+ void teach(Learner learner, double numberOfHours);
+ void lecture(Learner[] learners, double numberOfHours);
+}
diff --git a/src/main/java/io/zipcoder/interfaces/ZipCodeWilmington.java b/src/main/java/io/zipcoder/interfaces/ZipCodeWilmington.java
new file mode 100644
index 00000000..4fafcc1f
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/ZipCodeWilmington.java
@@ -0,0 +1,45 @@
+package io.zipcoder.interfaces;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ZipCodeWilmington {
+ private static final Students students = Students.getInstance();
+ private static final Instructors instructors = Instructors.getInstance();
+ private static final ZipCodeWilmington INSTANCE = new ZipCodeWilmington();
+
+ private ZipCodeWilmington(){}
+
+
+ public static ZipCodeWilmington getInstance(){
+ return INSTANCE;
+ }
+
+ public void hostLecture(Teacher teacher, double numberOfHours){
+ Learner[] learners = students.personList.toArray(new Learner[0]);
+ teacher.lecture(learners, numberOfHours);
+ }
+
+ public void hostLecture(long id, double numberOfHours){
+ Instructor instructor = instructors.personList.get((int)id);
+ Learner[] learners = students.personList.toArray(new Learner[0]);
+ instructor.lecture(learners, numberOfHours);
+ }
+
+ public HashMap getStudymap(){
+ Learner[] learners = students.personList.toArray(new Learner[0]);
+ HashMap studyMap = new HashMap<>();
+ for(Learner element : learners){
+ studyMap.put((Student) element, element.getTotalStudyTime());
+ }
+ return studyMap;
+ }
+
+ public Students getStudents() {
+ return students;
+ }
+
+ public Instructors getInstructors() {
+ return instructors;
+ }
+}
diff --git a/src/test/java/io/zipcoder/interfaces/TestInstructor.java b/src/test/java/io/zipcoder/interfaces/TestInstructor.java
new file mode 100644
index 00000000..0be7c7b3
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestInstructor.java
@@ -0,0 +1,47 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestInstructor {
+
+ @Test
+ public void testImplementation(){
+ Instructor instructor = new Instructor(10L, "SomeoneWhoCares");
+
+ Assert.assertTrue(instructor instanceof Teacher);
+ }
+
+ @Test
+ public void testInheritance(){
+ Instructor instructor = new Instructor(15L, "LiterallyAnyoneElse");
+
+ Assert.assertTrue(instructor instanceof Person);
+ }
+
+ @Test
+ public void testTeach(){
+ Instructor instructor = new Instructor(5L, "Available");
+
+ Learner learner = new Student(1L, "Pordy");
+ instructor.teach(learner, 10.00);
+
+ Double actual = learner.getTotalStudyTime();
+ Double expected = 10.00;
+
+ Assert.assertEquals(actual, expected);
+ }
+
+ @Test
+ public void testLecture(){
+ Instructor instructor = new Instructor(7L, "AnotherBootcampInstructor");
+
+ Learner[] learners = {new Student(2L, "AAA"), new Student(3L, "BBB")};
+ instructor.lecture(learners, 10.00);
+
+ Double actual = 5.00;
+ Double expected = learners[0].getTotalStudyTime();
+
+ Assert.assertEquals(expected, actual);
+ }
+}
diff --git a/src/test/java/io/zipcoder/interfaces/TestInstructors.java b/src/test/java/io/zipcoder/interfaces/TestInstructors.java
new file mode 100644
index 00000000..05729ba0
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestInstructors.java
@@ -0,0 +1,15 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestInstructors {
+ @Test
+ public void TestWhatever(){
+ Instructors instance = Instructors.getInstance();
+
+ Integer actual = instance.personList.size();
+ Integer expected = 3;
+ Assert.assertEquals(expected, actual);
+ }
+}
diff --git a/src/test/java/io/zipcoder/interfaces/TestPeople.java b/src/test/java/io/zipcoder/interfaces/TestPeople.java
new file mode 100644
index 00000000..3a597e19
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestPeople.java
@@ -0,0 +1,48 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.awt.*;
+
+public class TestPeople {
+
+ @Test
+ public void testAdd(){
+ People people = Instructors.getInstance();
+
+ Person person = new Person(2L, "Goe");
+ people.add(person);
+
+ Integer expected = 1;
+ Integer actual = people.count();
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testRemove(){
+ People people = Students.getInstance();
+
+ Person person = new Person(4L, "Eck");
+ people.add(person);
+ people.remove(person);
+
+ Integer expected = 0;
+ Integer actual = people.count();
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testFindById(){
+ People people = Students.getInstance();
+
+ Person person = new Person(5L, "Ys");
+ people.add(person);
+
+ Person actual = people.findById(5L);
+
+ Assert.assertEquals(person, actual);
+ }
+}
diff --git a/src/test/java/io/zipcoder/interfaces/TestPerson.java b/src/test/java/io/zipcoder/interfaces/TestPerson.java
index d64cd2f0..913e011d 100644
--- a/src/test/java/io/zipcoder/interfaces/TestPerson.java
+++ b/src/test/java/io/zipcoder/interfaces/TestPerson.java
@@ -1,5 +1,33 @@
package io.zipcoder.interfaces;
+import org.junit.Assert;
+import org.junit.Test;
+
public class TestPerson {
+ @Test
+ public void testConstructor(){
+ Person person = new Person(100L, "Joe");
+
+ String actualName = person.getName();
+ String expectedName = "Joe";
+
+ Long actualId = person.getId();
+ Long expectedId = 100L;
+
+ Assert.assertEquals(actualId, expectedId);
+ Assert.assertEquals(actualName, expectedName);
+ }
+
+ @Test
+ public void testSetName(){
+ Person person = new Person(200L, "Bonnie");
+
+ person.setName("Kara");
+
+ String actualName = person.getName();
+ String expectedName = "Kara";
+
+ Assert.assertEquals(actualName, expectedName);
+ }
}
diff --git a/src/test/java/io/zipcoder/interfaces/TestStudent.java b/src/test/java/io/zipcoder/interfaces/TestStudent.java
new file mode 100644
index 00000000..b770d6d5
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestStudent.java
@@ -0,0 +1,33 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestStudent {
+
+ @Test
+ public void testImplementation(){
+ Student student = new Student(100L, "Biff");
+
+ Assert.assertTrue(student instanceof Learner);
+ }
+
+ @Test
+ public void testInheritance(){
+ Student student = new Student(10L, "Bonk");
+
+ Assert.assertTrue(student instanceof Learner);
+ }
+
+ @Test
+ public void testLearn(){
+ Student student = new Student(15L, "Meke");
+
+ student.learn(100.00);
+
+ Double expected = 100.00;
+ Double actual = student.getTotalStudyTime();
+
+ Assert.assertEquals(expected, actual);
+ }
+}
diff --git a/src/test/java/io/zipcoder/interfaces/TestStudents.java b/src/test/java/io/zipcoder/interfaces/TestStudents.java
new file mode 100644
index 00000000..543212ff
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestStudents.java
@@ -0,0 +1,17 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestStudents {
+
+ @Test
+ public void TestWhatever(){
+ Students instance = Students.getInstance();
+
+ Integer actual = instance.personList.size();
+ Integer expected = 5;
+ Assert.assertEquals(expected, actual);
+ }
+
+}
diff --git a/src/test/java/io/zipcoder/interfaces/TestZipCodeWilmington.java b/src/test/java/io/zipcoder/interfaces/TestZipCodeWilmington.java
new file mode 100644
index 00000000..6ae4af9a
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestZipCodeWilmington.java
@@ -0,0 +1,24 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+public class TestZipCodeWilmington {
+
+ @Test
+ public void testHostLecture(){
+ ZipCodeWilmington zcw = ZipCodeWilmington.getInstance();
+ Educator teacher = Educator.LEON;
+
+ zcw.hostLecture(teacher, 100.00);
+ HashMap studyMap = zcw.getStudymap();
+
+ Double actual = studyMap.get(zcw.getStudents().personList.get(0));
+ Double expected = 20.00;
+
+ Assert.assertEquals(expected, actual);
+ }
+
+}
diff --git a/src/test/java/io/zipcoder/interfaces/testEducator.java b/src/test/java/io/zipcoder/interfaces/testEducator.java
new file mode 100644
index 00000000..0250655c
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/testEducator.java
@@ -0,0 +1,11 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Test;
+
+public class testEducator {
+
+ @Test
+ public void testConstructor(){
+ Educator educator = Educator.DOLIO;
+ }
+}