Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All steps completed, brain melted #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__junit_junit_4_12.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions interfaces-1.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
<groupId>io.zipcoder</groupId>
<artifactId>interfaces-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>

<name>interfaces-1</name>
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/io/zipcoder/interfaces/Educator.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
21 changes: 21 additions & 0 deletions src/main/java/io/zipcoder/interfaces/Instructor.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
21 changes: 21 additions & 0 deletions src/main/java/io/zipcoder/interfaces/Instructors.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.zipcoder.interfaces;

public final class Instructors extends People<Instructor>{
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];
}
}
6 changes: 6 additions & 0 deletions src/main/java/io/zipcoder/interfaces/Learner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.zipcoder.interfaces;

public interface Learner {
void learn(double numberOfHours);
Double getTotalStudyTime();
}
Loading