-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
184 lines (166 loc) · 3.97 KB
/
Copy pathStudent.java
File metadata and controls
184 lines (166 loc) · 3.97 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import java.io.Serializable;
import java.util.EmptyStackException;
/**
* PACKAGE_NAME
* Created by LêHoàngPhúc
* Date 10/21/2021 - 9:20 PM
* Description: ...
*/
public class Student implements Serializable {
//Attributes
private String studentID;
private String studentName;
private float gpa;
private String img;
private String address;
private String notes;
//Methods
//Constructors
/**
* Default constructor
*/
public Student() {
studentID="";
studentName="";
gpa=0;
img="";
address="";
notes="";
}
/**
* constructor with param
* @param st Student
*/
public Student(Student st){
this.studentID = st.studentID;
this.studentName = st.studentName;
this.gpa = st.gpa;
this.img = st.img;
this.address = st.address;
this.notes = st.notes;
}
/**
* constructor with param
* @param studentID string
* @param studentName string
* @param gpa float
* @param img string
* @param address string
* @param notes string
*/
public Student(String studentName, String studentID, float gpa, String img, String address, String notes) {
this.studentID = studentID;
this.studentName = studentName;
this.gpa = gpa;
this.img = img;
this.address = address;
this.notes = notes;
}
//getter and setter
/**
* get Student ID
* @return String
*/
public String getStudentID() {
return studentID;
}
/**
* get Student Name
* @return String
*/
public String getStudentName() {
return studentName;
}
/**
* get gpa
* @return float
*/
public float getGpa() {
return gpa;
}
/**
* get image
* @return String
*/
public String getImg() {
return img;
}
/**
* get address
* @return string
*/
public String getAddress() {
return address;
}
/**
* get notes
* @return string
*/
public String getNotes() {
return notes;
}
/**
* set student id
* @param studentID
*/
public void setStudentID(String studentID) {
if (studentID.equals("")) throw new NullPointerException("Du lieu rong. Khong the set du lieu!");
else this.studentID = studentID;
}
/**
* set student name
* @param studentName
*/
public void setStudentName(String studentName) {
if (studentName.equals("")) throw new NullPointerException("Du lieu rong. Khong the set du lieu!");
else this.studentName = studentName;
}
/**
* set gpa
* @param gpa
*/
public void setGpa(float gpa) {
this.gpa = gpa;
}
/**
* set image
* @param img
*/
public void setImg(String img) {
if (img.equals("")) throw new NullPointerException("Du lieu rong. Khong the set du lieu!");
else this.img = img;
}
/**
* set address
* @param address
*/
public void setAddress(String address) {
if (address.equals("")) throw new NullPointerException("Du lieu rong. Khong the set du lieu!");
else this.address = address;
}
/**
* set notes
* @param notes
*/
public void setNotes(String notes) {
this.notes = notes;
}
/**
* print student
*/
public void printStudent(){
System.out.printf("%-10s %8s %8s %8s %12s %7s %n",this.studentName,this.studentID,
this.gpa,this.address,this.img,this.notes);
}
/**
* print student
* @return String
*/
@Override
public String toString(){
String str="Tên sinh viên: "+this.studentName+"\n"+"Mã số sinh viên: "+this.studentID
+"\n"+"Điểm GPA: "+this.gpa+"\n"+"Địa chỉ: "+this.address+"\n"+"Hình ảnh: "+this.img+"\n"
+"Ghi chú: "+this.notes+"\n";
return str;
}
}