Skip to content

Commit 4568b9c

Browse files
committed
Initial framework for lesson 7 exercises.
1 parent cc736ba commit 4568b9c

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.launchcode.java.demos.lsn7interfaces;
2+
3+
import java.util.ArrayList;
4+
5+
public class Course {
6+
private static int nextCourseId = 100000;
7+
private int id;
8+
private String name;
9+
private int credits;
10+
private ArrayList<Teacher> instructors;
11+
12+
public Course(){
13+
id = nextCourseId;
14+
nextCourseId++;
15+
}
16+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.launchcode.java.demos.lsn7interfaces;
2+
3+
import java.util.ArrayList;
4+
5+
public class School {
6+
private ArrayList<Course> courses;
7+
private ArrayList<Teacher> teachers;
8+
private ArrayList<Student> students;
9+
10+
11+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.launchcode.java.demos.lsn7interfaces;
2+
3+
import java.util.ArrayList;
4+
5+
public class Student {
6+
private static int nextStudentId = 1;
7+
private int id;
8+
private String name;
9+
private ArrayList<Course> schedule;
10+
private double gpa;
11+
12+
public Student(){
13+
id = nextStudentId;
14+
nextStudentId++;
15+
}
16+
17+
public Student(String aName, ArrayList<Course> aSchedule, double aGpa){
18+
this();
19+
name = aName;
20+
schedule = aSchedule;
21+
gpa = aGpa;
22+
}
23+
24+
private String printSchedule(ArrayList<Course> classList){
25+
String output = "";
26+
for (Course item : classList){
27+
output += item+"\n";
28+
}
29+
return output;
30+
}
31+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.launchcode.java.demos.lsn7interfaces;
2+
3+
import java.util.ArrayList;
4+
import java.util.HashMap;
5+
6+
public class Teacher {
7+
private String name;
8+
private HashMap<Course, ArrayList<Student>> classesTaught;
9+
}

0 commit comments

Comments
 (0)