diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..0e40fe8f
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+
+# Default ignored files
+/workspace.xml
\ No newline at end of file
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 00000000..a0f2c3a1
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+interfaces-1
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 00000000..fdc60f4f
--- /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..b26911bd
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ 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..fcb46ee0
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ 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/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..0ddf51c1
--- /dev/null
+++ b/interfaces-1.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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..e42a9ee6
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Educator.java
@@ -0,0 +1,31 @@
+package io.zipcoder.interfaces;
+
+public enum Educator implements Teacher {
+ KRIS(new Instructor(35, "Kris"),0),
+ ROBERTO(new Instructor(36, "Roberto"),0),
+ CHRIS(new Instructor(37, "Chris"),0);
+
+ private final Instructor instructor;
+ double timeWorked;
+
+ Educator(Instructor instructor, double timeWorked){
+ this.instructor = instructor;
+ this.timeWorked = timeWorked;
+ Instructors instructors = Instructors.getInstance();
+ instructors.addPerson(instructor);
+ }
+
+ public void teach(Learner learner, double numberOfHours) {
+ this.instructor.teach(learner,numberOfHours);
+ timeWorked += numberOfHours;
+ }
+
+ public void lecture(Learner[]learners, double numberOfHours) {
+ this.instructor.lecture(learners,numberOfHours);
+ timeWorked += numberOfHours;
+ }
+
+ public double getTimeWorked() {
+ return timeWorked;
+ }
+}
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..a8cac262
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Instructor.java
@@ -0,0 +1,22 @@
+package io.zipcoder.interfaces;
+
+public class Instructor extends Person implements Teacher {
+
+ public Instructor(long id, String name) {
+ super(id, name);
+ }
+
+ public void teach(Learner learner, double numberOfHours) {
+ learner.learn(numberOfHours);
+
+ }
+
+ public void lecture(Learner[] learners, double numberOfHours) {
+ double numberOfHoursPerLearner = numberOfHours/learners.length;
+
+ for (int i = 0; i < learners.length; i++) {
+ learners[i].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..500bf94d
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Instructors.java
@@ -0,0 +1,24 @@
+package io.zipcoder.interfaces;
+
+public final class Instructors extends People {
+ private static final Instructors INSTANCE = new Instructors();
+
+ private Instructors() {
+
+ Instructor instructor = new Instructor(35, "Kris");
+ Instructor instructor1 = new Instructor(36, "Roberto");
+ Instructor instructor2 = new Instructor(37, "Chris");
+
+ personList.add(instructor);
+ personList.add(instructor1);
+ personList.add(instructor2);
+ }
+
+ public Instructor[] toArray() {
+ return personList.toArray(new Instructor[personList.size()]);
+ }
+
+ public static Instructors getInstance(){
+ return INSTANCE;
+ }
+}
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..05f4ec00
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Learner.java
@@ -0,0 +1,10 @@
+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..056ca6fb
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/People.java
@@ -0,0 +1,58 @@
+package io.zipcoder.interfaces;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public abstract class People implements Iterable {
+
+ List personList;
+
+ public People(){
+ personList= new ArrayList();
+ }
+
+ public void addPerson(E person){
+ personList.add(person);
+ }
+
+ public Person findById(Long id){
+ Person personFinder = null;
+ for (int i = 0; i < personList.size(); i++) {
+ if (personList.get(i).getId()==id){
+ personFinder = personList.get(i);
+ }
+ }return personFinder;
+ }
+
+ public Boolean contains(E person){
+ return personList.contains(person);
+ }
+
+ public void removePerson(E person){
+ personList.remove(person);
+ }
+
+ public void removeById(Long id) {
+ for (int i = 0; i < personList.size(); i++) {
+ if (personList.get(i).getId() == id) {
+ personList.remove(personList.get(i));
+ }
+ }
+ }
+ public void removeAll(){
+ personList.removeAll(personList);
+ }
+
+ public int count(){
+ return personList.size();
+ }
+
+ public abstract E[] toArray();
+
+
+
+ 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..166a9d47 100644
--- a/src/main/java/io/zipcoder/interfaces/Person.java
+++ b/src/main/java/io/zipcoder/interfaces/Person.java
@@ -1,5 +1,29 @@
package io.zipcoder.interfaces;
public class Person {
+ final Long id;
+ private String name;
+
+
+ public Person(long id, String name) {
+ this.name = name;
+ this.id = id;
+ }
+ public Long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return 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..6f54a2f1
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Student.java
@@ -0,0 +1,22 @@
+package io.zipcoder.interfaces;
+
+public class Student extends Person implements Learner {
+ double totalStudyTime;
+
+
+
+ public Student(long id, String name) {
+ super(id, name);
+ }
+
+
+ public void learn(double numberOfHours) {
+ totalStudyTime+=numberOfHours;
+ }
+
+ 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..246f2398
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Students.java
@@ -0,0 +1,27 @@
+package io.zipcoder.interfaces;
+
+public final class Students extends People {
+ private static final Students INSTANCE = new Students();
+
+ private Students() {
+ Student student = new Student(25, "Sandy");
+ Student student1 = new Student(26, "Meeeee");
+ Student student2 = new Student(27, "Kievina");
+
+ personList.add(student);
+ personList.add(student1);
+ personList.add(student2);
+ }
+
+ public Student[] toArray() {
+ return personList.toArray(new Student[personList.size()]);
+ }
+
+ public static Students getInstance() {
+ return INSTANCE;
+ }
+
+
+
+}
+
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..5cfe6d2e
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/Teacher.java
@@ -0,0 +1,7 @@
+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..1d560753
--- /dev/null
+++ b/src/main/java/io/zipcoder/interfaces/ZipCodeWilmington.java
@@ -0,0 +1,41 @@
+package io.zipcoder.interfaces;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ZipCodeWilmington {
+ private static final ZipCodeWilmington INSTANCE = new ZipCodeWilmington();
+ private static final Students students = Students.getInstance();
+ private static final Instructors instructors = Instructors.getInstance();
+
+
+ private ZipCodeWilmington() {
+
+ }
+
+ public void hostLecture(Teacher teacher, double numberOfHours) {
+ teacher.lecture(students.toArray(), numberOfHours);
+ }
+
+ public void hostLecture(long id, double numberOfHours) {
+ Teacher teacher = (Instructor) instructors.findById(id);
+ teacher.lecture(students.toArray(), numberOfHours);
+
+
+ }
+
+ public Map getStudyMap() {
+ Map timeMap = new HashMap();
+
+ for (Student s : students) {
+ timeMap.put(s, s.getTotalStudyTime());
+ }
+ return timeMap;
+ }
+
+ public static ZipCodeWilmington getInstance() {
+ return INSTANCE;
+ }
+
+
+}
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..281ed21c
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestEducator.java
@@ -0,0 +1,41 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestEducator {
+
+ @Test
+ public void testEduImplementation() {
+ Assert.assertTrue( Educator.KRIS instanceof Teacher);
+ }
+
+
+
+
+ @Test
+ public void testTeach() {
+
+ Student student = new Student(9, "Bob");
+
+ Educator.KRIS.teach(student, 10);
+ double actual = student.getTotalStudyTime();
+ double expected = 10.0;
+ Assert.assertEquals(expected, actual,0);
+ }
+
+ @Test
+ public void testLecture() {
+ Learner[] learners = new Learner[3];
+ for (int i = 0; i < 3; i++) {
+ learners[i] = new Student(i, "Brian" + i);
+ }
+
+ Educator.ROBERTO.lecture(learners, 9);
+ double actual = learners[1].getTotalStudyTime();
+ double expected = 3;
+ Assert.assertEquals(expected, actual,0 );
+
+ }
+}
+
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..fa8dc3fe
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestInstructor.java
@@ -0,0 +1,45 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestInstructor {
+
+ @Test
+ public void testImplementaion() {
+ Instructor instructor = new Instructor(10, "Ann");
+ Assert.assertTrue(instructor instanceof Teacher);
+ }
+
+ @Test
+ public void testInheritance() {
+ Instructor instructor = new Instructor(10, "Ann");
+ Assert.assertTrue(instructor instanceof Person);
+ }
+
+ @Test
+ public void testTeach() {
+ Instructor instructor = new Instructor(10, "Ann");
+ Student student = new Student(9, "Bob");
+
+ instructor.teach(student, 10);
+ double actual = student.getTotalStudyTime();
+ double expected = 10.0;
+ Assert.assertEquals(expected, actual,0);
+ }
+
+ @Test
+ public void testLecture() {
+ Instructor instructor = new Instructor(10, "Ann");
+ Learner[] learners = new Learner[3];
+ for (int i = 0; i < 3; i++) {
+ learners[i] = new Student(i, "Brian" + i);
+ }
+
+ instructor.lecture(learners, 9);
+ double actual = learners[1].getTotalStudyTime();
+ double expected = 3;
+ Assert.assertEquals(expected, actual,0 );
+
+ }
+}
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..774f927e
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestInstructors.java
@@ -0,0 +1,32 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestInstructors {
+
+
+ @Test
+ public void studentsContainsTest() {
+ Instructors test = Instructors.getInstance();
+
+ int actual = test.count();
+ int expected = 3;
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void name() {
+ }
+
+ @Test
+ public void instructorsContainsTest2() {
+ Instructors test = Instructors.getInstance();
+ Person actual = test.findById(35L);
+ Person expected = test.personList.get(0);
+
+ 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..f9041519
--- /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.Before;
+import org.junit.Test;
+
+public class TestPeople {
+ @Before
+ public void setUp() {
+
+ }
+
+ @Test
+ public void addTest() {
+ Students classroom = Students.getInstance();
+ Student student = new Student(55,"Bibby");
+ Student student1 = new Student(15, "Red");
+ Student student2= new Student(16,"Blue");
+ classroom.addPerson(student);
+ classroom.addPerson(student1);
+ classroom.addPerson(student2);
+ int actual = classroom.count();
+ int expected = 6;
+ Assert.assertEquals(actual, expected);
+ }
+
+ @Test
+ public void removeTest() {
+
+ Students classroom = Students.getInstance();
+ classroom.removePerson(classroom.toArray()[1]);
+ int actual = classroom.count();
+ int expected = 5;
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testFindById() {
+ Students classroom = Students.getInstance();
+
+ Person expected = classroom.findById(55L);
+ Person actual = classroom.personList.get(3);
+
+ Assert.assertEquals(actual, expected);
+
+ }
+
+}
diff --git a/src/test/java/io/zipcoder/interfaces/TestPerson.java b/src/test/java/io/zipcoder/interfaces/TestPerson.java
index d64cd2f0..fdaa7dd6 100644
--- a/src/test/java/io/zipcoder/interfaces/TestPerson.java
+++ b/src/test/java/io/zipcoder/interfaces/TestPerson.java
@@ -1,5 +1,32 @@
package io.zipcoder.interfaces;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
public class TestPerson {
+
+ @Test
+ public void personConstructorTest() {
+ Person person = new Person(9, "Bob");
+ long actual = person.getId();
+ String actual1 = person.getName();
+ long expected = 9;
+ String expected1 = "Bob";
+
+ Assert.assertEquals(actual,expected);
+ Assert.assertEquals(actual1,expected1);
+ }
+ @Test
+ public void setNameTest() {
+ Person person = new Person(9, "Bob");
+ person.setName("Jim");
+ String actual = person.getName();
+ String expected = "Jim";
+
+ Assert.assertEquals(actual, expected);
+ }
+
+
}
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..14fd84c8
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestStudent.java
@@ -0,0 +1,31 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.notification.StoppedByUserException;
+
+public class TestStudent {
+
+ @Test
+ public void studentIsLearnerTest(){
+ Student student = new Student(9, "Bob");
+ Assert.assertTrue(student instanceof Learner);
+ }
+ @Test
+ public void studentIsPersonTest(){
+ Student student = new Student(9, "Bob");
+ Assert.assertTrue(student instanceof Person);
+ }
+ @Test
+ public void testLearn(){
+ Student student = new Student(9, "Bob");
+ student.learn(10);
+ double actual = student.getTotalStudyTime();
+ student.learn(10);
+ double expected = student.getTotalStudyTime();
+
+ Assert.assertEquals(actual+10.0, expected,0);
+ }
+}
+
+
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..8cb8751b
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestStudents.java
@@ -0,0 +1,30 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestStudents {
+
+ @Test
+ public void studentsContainsTest(){
+ Students test = Students.getInstance();
+
+ int actual = test.count();
+ int expected = 3;
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void name() {
+ }
+
+ @Test
+ public void studentsContainsTest2(){
+ Students test = Students.getInstance();
+ Person actual = test.findById(25L);
+ Person expected = test.personList.get(0);
+
+ 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..7784b1ef
--- /dev/null
+++ b/src/test/java/io/zipcoder/interfaces/TestZipCodeWilmington.java
@@ -0,0 +1,28 @@
+package io.zipcoder.interfaces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Map;
+
+public class TestZipCodeWilmington {
+ @Test
+ public void testHostLecture(){
+ ZipCodeWilmington test = ZipCodeWilmington.getInstance();
+ Instructors testTeach = Instructors.getInstance();
+ Students testStudents = Students.getInstance();
+
+ test.hostLecture(testTeach.toArray()[1], 9);
+ Map timeTable = test.getStudyMap();
+ Object actual = timeTable.get(testStudents.findById(25L));
+ Assert.assertEquals(30, actual);
+
+ }
+ @Test
+ public void testHostEnumLecture(){
+ ZipCodeWilmington test = ZipCodeWilmington.getInstance();
+ Students testStudents = Students.getInstance();
+ test.hostLecture(Educator.KRIS,12);
+ Assert.assertEquals(testStudents.toArray()[1].totalStudyTime,4.0,0);
+ }
+}