Kaynağa Gözat

first commit

Leon 7 yıl önce
işleme
1d7c0eb2a5

+ 27
- 0
.classpath Dosyayı Görüntüle

@@ -0,0 +1,27 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
4
+		<attributes>
5
+			<attribute name="optional" value="true"/>
6
+			<attribute name="maven.pomderived" value="true"/>
7
+		</attributes>
8
+	</classpathentry>
9
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10
+		<attributes>
11
+			<attribute name="optional" value="true"/>
12
+			<attribute name="maven.pomderived" value="true"/>
13
+		</attributes>
14
+	</classpathentry>
15
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
16
+		<attributes>
17
+			<attribute name="maven.pomderived" value="true"/>
18
+		</attributes>
19
+	</classpathentry>
20
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
21
+		<attributes>
22
+			<attribute name="maven.pomderived" value="true"/>
23
+		</attributes>
24
+	</classpathentry>
25
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
26
+	<classpathentry kind="output" path="target/classes"/>
27
+</classpath>

+ 23
- 0
.project Dosyayı Görüntüle

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>interfaces-1</name>
4
+	<comment></comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.jdt.core.javabuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>org.eclipse.m2e.core.maven2Builder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+	</buildSpec>
19
+	<natures>
20
+		<nature>org.eclipse.jdt.core.javanature</nature>
21
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
22
+	</natures>
23
+</projectDescription>

+ 4
- 0
.settings/org.eclipse.core.resources.prefs Dosyayı Görüntüle

@@ -0,0 +1,4 @@
1
+eclipse.preferences.version=1
2
+encoding//src/main/java=UTF-8
3
+encoding//src/test/java=UTF-8
4
+encoding/<project>=UTF-8

+ 12
- 0
.settings/org.eclipse.jdt.core.prefs Dosyayı Görüntüle

@@ -0,0 +1,12 @@
1
+eclipse.preferences.version=1
2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5
+org.eclipse.jdt.core.compiler.compliance=1.7
6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
8
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
12
+org.eclipse.jdt.core.compiler.source=1.7

+ 4
- 0
.settings/org.eclipse.m2e.core.prefs Dosyayı Görüntüle

@@ -0,0 +1,4 @@
1
+activeProfiles=
2
+eclipse.preferences.version=1
3
+resolveWorkspaceProjects=true
4
+version=1

+ 146
- 0
README.md Dosyayı Görüntüle

@@ -0,0 +1,146 @@
1
+# Part 1.0 - Create `Person` Class
2
+* Create a `Person` class.
3
+	* `Person` constructor should have a parameter of type `String` which sets the `name` instance-variable to the respective argument.
4
+	* `Person` should have a `getName()` method which returns the `Person` object's `name` variable.
5
+	* `Person` should have a `setName()` method which sets the `Person` object's `name` variable.
6
+
7
+-
8
+# Part 1.1 - Test `Person`
9
+* Create a `TestPerson` class.
10
+	* Create a `testSetName` method which ensures that a `Person` object's `name` variable is being set by invoking the `.setName` method.
11
+	* Create a `testConstructor` method which ensures that a `Person` object's `name` variable is being set by invoking the `Person` constructor.
12
+
13
+-
14
+# Part 2.0 - Create `Learner` Interface
15
+* Create a `Learner` interface.
16
+	* `Learner` should declare one method signature:
17
+		* Method name: `learn`
18
+		* Method parameters: `double numberOfHours`
19
+		* Method return-type: `void`
20
+
21
+-
22
+# Part 3.0 - Create `Student` Class
23
+* Create a `Student` class such that:
24
+	* `Student` is a subclass of `Person`
25
+	* `Student` implements the `Learner` interface
26
+	* `Student` should have an instance variable `totalStudyTime` of type `double`
27
+	* `Student` should have a concrete implementation of the `learn` method which increments the `totalStudyTime` variable by the specified `numberOfHours` argument.
28
+	* `Student` should have a `getTotalStudyTime()` method which returns the `totalStudyTime` instance variable.
29
+
30
+
31
+-
32
+# Part 3.1 - Test `Student`
33
+* Create a `TestStudent` class.
34
+	* Create a `testImplementation` method that asserts that a `Student` is an `instanceof` a `Learner`.
35
+	* Create a `testInheritance` method that asserts that a `Student` is an `instanceof` a `Person`.
36
+	* Create a `testLearn` method that ensures a `Student`'s `totalStudyTime` instance variable is incremented by the specified `numberOfHours` by invoking the `.learn` method.
37
+
38
+-
39
+# Part 4.0 - Create `Teacher` Interface
40
+* Create a `Teacher` interface.
41
+	* `Teacher` should declare a `teach` method signature:
42
+		* Method name: `teach`
43
+		* Method parameters:
44
+			* `Student student`
45
+			* `double numberOfHours`
46
+		* Method return-type: `void` 
47
+
48
+	* `Teacher` should declare a `lecture` method signature:
49
+		* Method name: `lecture`
50
+		* Method parameters:
51
+			* `Student[] student, double numberOfHours`
52
+		* Method return-type: `void`
53
+
54
+		
55
+-
56
+# Part 5.0 - Create `Instructor` Class
57
+* Create an `Instructor` class such that:
58
+	* `Instructor` is a subclass of `Person`
59
+	* `Instructor` implements the `Teacher` interface
60
+	* `Instructor` should have a concrete implementation of the `teach` method which invokes the `learn` method on the specified `Student` object.
61
+	* `Instructor` should have a concrete implementation of the `lecture` method which invokes the `learn` method on the specified array of `Student` objects.
62
+		* `numberOfHours` should be evenly split amongst the students.
63
+			* `double numberOfHoursPerStudent = numberOfHours / students.length;`
64
+
65
+-
66
+# Part 5.1 - Test `Instructor`
67
+* Create an `TestInstructor` class.
68
+	* Create a `testImplementation` method that asserts that an `Instructor` is an `instanceof` a `Teacher`.
69
+	* Create a `testInheritance` method that asserts that a `Instructor` is an `instanceof` a `Person`.
70
+	* Create a `testTeach` method that ensures when an `Instructor` invokes the `.teach` method, a respective student's `totalStudyTime` instance variable is incremented.
71
+	* Create a `testLecture` method that ensures when an `Instructor` invokes the `.teach` method, a respective student's `totalStudyTime` instance variable is incremented.
72
+
73
+	
74
+-
75
+# Part 6 - Create `ZipCodeWilmington` Class
76
+* Create a `ZipCodeWilmington` class.
77
+	* _Statically_ instantiate a `private` `ArrayList` of `Instructor` objects called `instructorList`.
78
+	* Create a `public static` method called `hire` which adds an `Instructor` to the `instructorList` and returns `void`.
79
+	* Create a `public static` method called `getInstructors` which returns the `instructorList`.
80
+	* Create a `public static` method called `fireStaff` which clears our `instructorList`.
81
+	* Copy and paste this `static initialization block` immediately below your `instructorList` declaration.
82
+
83
+```java
84
+static { // static initializer
85
+	String[] instructorNames = { "Leon", "Tariq", "Froilan", "David", "Zach", "Iyasu" };
86
+	for (String instructorName : instructorNames) {
87
+		Instructor instructor = new Instructor(instructorName);
88
+		hire(instructor);
89
+	}
90
+}
91
+```
92
+
93
+
94
+-
95
+# Part 6.1 - Test `ZipCodeWilmington`
96
+* Create a `TestZipCodeWilmington` class.
97
+	* Create a method named `setup` which is annotated with `@Before`, takes has no parameters, and returns `void`.
98
+		* Ensure this method invokes the `.fireStaff` method on `ZipCodeWilmington`
99
+	
100
+	* Create a `testFireStaff` method which ensures that our `instructorList` in our `ZipCodeWilmington` class `isEmpty` upon invokation.
101
+	* Create a `testHireStaff` method which ensures that our `instructorList` is populated with respective `Instructor` objects.
102
+
103
+-
104
+# Part 7 - Create `TechConnect` Class
105
+* Create a `TechConnect` class.
106
+	* _Statically_ instantiate a `private` `ArrayList` of `Student` objects called `studentList`.
107
+	* Create a `public static` method called `recruitStudent` which adds a `Student` to the `studentList` and returns `void`.
108
+	* Create a `public static` method called `getStudents` which returns the `studentList`.
109
+	* Create a `public static` method called `removeStudents` which clears our `studentList`.
110
+	* Copy and paste this `static initialization block` immediately below your `studentList` declaration.
111
+
112
+```java
113
+static { // static initializer
114
+	String[] studentNames = { "Karen", "Liel", "Quinn", "Destiny", "Blesson", "Danielle B.", "Andre", "Jeff",
115
+			"Carlo", "Julia D.", "Natalie", "Julia E.", "Shylee", "Genevieve", "Margo", "Whitney", "Rachel",
116
+			"Bridget", "Seung", "Jessica", "Harry", "Kesler", "Darin", "Jade", "Dominika", "Nashae", "Brianna",
117
+			"Laurent", "Rina", "Emily", "Elisha", "Caitlin", "Kierra", "Dana", "Alyssa", "Humaira", "Prajwal",
118
+			"Cristine", "Blesson", "Brendan" };
119
+	for (String studentName : studentNames) {
120
+		Student student = new Student(studentName);
121
+		studentList.add(student);
122
+	}
123
+}
124
+```
125
+
126
+
127
+-
128
+# Part 7.1 - Test `TechConnect`
129
+* Create a `TestTechConnect` class.
130
+	* Create a method named `setup` which is annotated with `@Before`, takes has no parameters, and returns `void`.
131
+		* Ensure this method invokes the `.removeStudents` method on `TechConnect`
132
+	
133
+	* Create a `testRemoveStudents` method which ensures that our `studentList` in our `TechConnect` class `isEmpty` upon invokation.
134
+	* Create a `testRecruitStudent` method which ensures that our `studentList` is populated with respective `Student` objects.
135
+
136
+-
137
+# Part 8 - Create `ClassRoom` Class
138
+* Create a `ClassRoom` class.
139
+	* _Statically_ instantiate a `private` `ArrayList` of `Student` objects called `students` by invoking the `getStudents` method on the `TechConnect` class.
140
+	* _Statically_ instantiate a `private` `ArrayList` of `Instructor` objects called `instructors` by invoking the `getInstructor` method on the `ZipCodeWilmington` class.
141
+	* Create a method named `getRoster` which returns a `HashMapping` of `String` to `Person` objects such that our `ZipCodeWilmington` instructors and `TechConnect` students' names map to their respective `Person` object.
142
+
143
+-
144
+# Part 8.1 - Test `ClassRoom`
145
+* Create a `TestClassRoom` class.
146
+	* Assert that the `HashMapping` returned by `getRoster`, returns a `valueSet` containing each of the `Person` objects in `ZipCodeWilmington`'s `instructorList` and `TechConnect`'s `studentList`.

+ 25
- 0
pom.xml Dosyayı Görüntüle

@@ -0,0 +1,25 @@
1
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+  <modelVersion>4.0.0</modelVersion>
4
+
5
+  <groupId>io.zipcoder</groupId>
6
+  <artifactId>interfaces-1</artifactId>
7
+  <version>0.0.1-SNAPSHOT</version>
8
+  <packaging>jar</packaging>
9
+
10
+  <name>interfaces-1</name>
11
+  <url>http://maven.apache.org</url>
12
+
13
+  <properties>
14
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15
+  </properties>
16
+
17
+  <dependencies>
18
+    <dependency>
19
+      <groupId>junit</groupId>
20
+      <artifactId>junit</artifactId>
21
+      <version>3.8.1</version>
22
+      <scope>test</scope>
23
+    </dependency>
24
+  </dependencies>
25
+</project>

+ 5
- 0
target/classes/META-INF/MANIFEST.MF Dosyayı Görüntüle

@@ -0,0 +1,5 @@
1
+Manifest-Version: 1.0
2
+Built-By: leon
3
+Build-Jdk: 1.8.0_131
4
+Created-By: Maven Integration for Eclipse
5
+

+ 7
- 0
target/classes/META-INF/maven/io.zipcoder/interfaces-1/pom.properties Dosyayı Görüntüle

@@ -0,0 +1,7 @@
1
+#Generated by Maven Integration for Eclipse
2
+#Wed Jul 12 21:48:05 EDT 2017
3
+version=0.0.1-SNAPSHOT
4
+groupId=io.zipcoder
5
+m2e.projectName=interfaces-1
6
+m2e.projectLocation=/Users/leon/Documents/workspace/eclipse/interfaces-1
7
+artifactId=interfaces-1

+ 25
- 0
target/classes/META-INF/maven/io.zipcoder/interfaces-1/pom.xml Dosyayı Görüntüle

@@ -0,0 +1,25 @@
1
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+  <modelVersion>4.0.0</modelVersion>
4
+
5
+  <groupId>io.zipcoder</groupId>
6
+  <artifactId>interfaces-1</artifactId>
7
+  <version>0.0.1-SNAPSHOT</version>
8
+  <packaging>jar</packaging>
9
+
10
+  <name>interfaces-1</name>
11
+  <url>http://maven.apache.org</url>
12
+
13
+  <properties>
14
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15
+  </properties>
16
+
17
+  <dependencies>
18
+    <dependency>
19
+      <groupId>junit</groupId>
20
+      <artifactId>junit</artifactId>
21
+      <version>3.8.1</version>
22
+      <scope>test</scope>
23
+    </dependency>
24
+  </dependencies>
25
+</project>