This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
forked from ajN2O/ICS201
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDepartment.java
82 lines (59 loc) · 1.81 KB
/
Department.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package application;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
public class Department implements Serializable{
private String code;
private String name;
private LinkedList<Student> students ;
public Department(String code, String name, LinkedList<Student> students) {
this.code = code;
this.name = name;
this.students = students;
}
public LinkedList<Student> getStudents() {
return students;
}
public void setStudents(LinkedList<Student> students) {
this.students = students;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Department [code=" + code + ", name=" + name + ", students=" + students + "]";
}
public void addStudent(Student student) {
students.add(student);
}
/*public static void main(String[] args) {
LinkedList<Department> dpt;
try {
ObjectInputStream objReader = new ObjectInputStream(new FileInputStream("departments.dat"));
LinkedList<Department> readObject = extracted(objReader);
LinkedList<Department> temp = readObject;
System.out.println(temp);
objReader.close();
} catch (FileNotFoundException createFile) {
System.out.println("File was not found, creating file with default values");
} catch (IOException e) {
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static LinkedList<Department> extracted(ObjectInputStream objReader)
throws IOException, ClassNotFoundException {
return (LinkedList<Department>) objReader.readObject();
}*/
}