-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student.java
149 lines (130 loc) · 2.99 KB
/
Student.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package java_project;
//import java.io.Serializable; // 객체 타입 파일 입출력
public class Student implements Comparable<Student>{
private String name, stdid = null, major, tel; // 학생 정보
private String sub1,sub2,sub3; // 수강 과목
private int sub1_mid, sub1_fin,sub2_mid, sub2_fin,sub3_mid, sub3_fin, rank; // 수강 과목 및 등수
private Integer totalscore; // 과목별 총 점
// 학생 데이터 생성자
public Student(String name, int totalscore, String stdid, String major, String tel, String sub1, int sub1_mid, int sub1_fin, String sub2, int sub2_mid, int sub2_fin, String sub3, int sub3_mid, int sub3_fin, int rank) {
this.name=name;
this.totalscore=totalscore;
this.stdid=stdid;
this.major=major;
this.tel=tel;
this.sub1=sub1;
this.sub2=sub2;
this.sub3=sub3;
this.sub1_mid=sub1_mid;
this.sub1_fin=sub1_fin;
this.sub2_mid=sub2_mid;
this.sub2_fin=sub2_fin;
this.sub3_mid=sub3_mid;
this.sub3_fin=sub3_fin;
this.rank=rank;
rank=0; // 등수 초기화
totalscore=0;
}
// 학생 이름 getter, setter 메소드
public String getName() {
return name;
}
public void setName(String name) {
this.name=name;
}
public int getTotalscore() {
return totalscore;
}
public void setTotalscore(int totalscore) {
this.totalscore=totalscore;
}
// 학번 getter, setter 메소드
public String getStdid() {
return stdid;
}
public void settdid(String stdid) {
this.stdid=stdid;
}
// 학과 getter, setter 메소드
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major=major;
}
// 전화번호 getter, setter 메소드
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel=tel;
}
// 과목 getter, setter 메소드
public String getSub1() {
return sub1;
}
public void setSub1(String sub1) {
this.sub1=sub1;
}
public String getSub2() {
return sub2;
}
public void setSub2(String sub2) {
this.sub2=sub2;
}
public String getSub3() {
return sub3;
}
public void setSub3(String sub3) {
this.sub3=sub3;
}
// 중간고사 getter, setter 메소드
public int getSub1_mid() {
return sub1_mid;
}
public void setSub1_mid(int sub1_mid) {
this.sub1_mid=sub1_mid;
}
public int getSub2_mid() {
return sub2_mid;
}
public void setSub2_mid(int sub2_mid) {
this.sub2_mid=sub2_mid;
}
public int getSub3_mid() {
return sub3_mid;
}
public void setSub3_mid(int sub3_mid) {
this.sub3_mid=sub3_mid;
}
//기말고사 getter, setter 메소드
public int getSub1_fin() {
return sub1_fin;
}
public void setSub1_fin(int sub1_fin) {
this.sub1_fin=sub1_fin;
}
public int getSub2_fin() {
return sub2_fin;
}
public void setSub2_fin(int sub2_fin) {
this.sub2_fin=sub2_fin;
}
public int getSub3_fin() {
return sub3_fin;
}
public void setSub3_fin(int sub3_fin) {
this.sub3_fin=sub3_fin;
}
// 등수getter, setter 메소드
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank=rank;
}
@Override
public int compareTo(Student s) {
return totalscore.compareTo(s.getTotalscore());
}
}