-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGiangVien.java
152 lines (128 loc) · 4.57 KB
/
GiangVien.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
150
151
152
package com.thanhttt.baitaplon;
import java.text.ParseException;
import java.util.Date;
public class GiangVien {
private static int dem;
private String maGV, hoGV, tenGV;
private GioiTinh gioiTinh;
private Date namSinh;
private HocHam hocHam;
private HocVi hocVi;
public GiangVien() {
}
public GiangVien(String hoGV, String tenGV, GioiTinh gioiTinh, Date namSinh, HocHam hocHam, HocVi hocVi) {
this.hoGV = hoGV;
this.tenGV = tenGV;
this.gioiTinh = gioiTinh;
this.namSinh = namSinh;
this.hocHam = hocHam;
this.hocVi = hocVi;
maGV = String.format("GV%04d", ++dem);
}
public GiangVien(String hoGV, String tenGV, String gioiTinh, String namSinh, String hocHam, String hocVi) throws ParseException {
this.hoGV = hoGV;
this.tenGV = tenGV;
setGioiTinh(gioiTinh);
setNamSinh(namSinh);
setHocHam(hocHam);
setHocVi(hocVi);
maGV = String.format("GV%04d", ++dem);
}
public String getHoGV() {
return hoGV;
}
public void setHoGV(String hoGV) {
this.hoGV = hoGV;
}
public String getTenGV() {
return tenGV;
}
public void setTenGV(String tenGV) {
this.tenGV = tenGV;
}
public GioiTinh getGioiTinh() {
return gioiTinh;
}
public void setGioiTinh(GioiTinh gioiTinh) {
this.gioiTinh = gioiTinh;
}
public void setGioiTinh(String gioiTinh) {
if ("Nam".equals(gioiTinh) || "nam".equals(gioiTinh) || "NAM".equals(gioiTinh))
this.gioiTinh = GioiTinh.NAM;
else if ("Nu".equals(gioiTinh) || "nu".equals(gioiTinh) || gioiTinh == "NU")
this.gioiTinh = GioiTinh.NU;
else if ("Khac".equals(gioiTinh) || "khac".equals(gioiTinh) || "KHAC".equals(gioiTinh))
this.gioiTinh = GioiTinh.KHAC;
}
public Date getNamSinh() {
return namSinh;
}
public void setNamSinh(Date namSinh) {
this.namSinh = namSinh;
}
public void setNamSinh(String namSinh) throws ParseException {
this.namSinh = CauHinh.f.parse(namSinh);
}
public HocHam getHocHam() {
return hocHam;
}
public void setHocHam(HocHam hocHam) {
this.hocHam = hocHam;
}
public void setHocHam(String hocHam) {
try {
if ("GS".equals(hocHam) || "Giao su".equals(hocHam) || "giao su".equals(hocHam) || "Giao Su".equals(hocHam) || "GIAO SU".equals(hocHam) || "GIAO_SU".equals(hocHam))
this.hocHam = HocHam.GIAO_SU;
else if ("PGS".equals(hocHam) || "Pho giao su".equals(hocHam) || "pho giao su".equals(hocHam) || "Pho Giao Su".equals(hocHam) || "PHO GIAO SU".equals(hocHam) || "PHO_GIAO_SU".equals(hocHam))
this.hocHam = HocHam.PHO_GIAO_SU;
}
catch(IllegalArgumentException e){
System.out.println("Du lieu nhap vao khong hop le!");
}
}
public HocVi getHocVi() {
return hocVi;
}
public void setHocVi(HocVi hocVi) {
this.hocVi = hocVi;
}
public void setHocVi(String hocVi){
try{
if (null != hocVi)
switch (hocVi) {
case "ThS":
case "Thac si":
case "thac si":
case "Thac Si":
case "THAC SI":
case "THAC_SI":
this.hocVi = HocVi.THAC_SI;
break;
case "TS":
case "Tien si":
case "tien si":
case "Tien Si":
case "TIEN SI":
case "TIEN_SI":
this.hocVi = HocVi.TIEN_SI;
break;
default:
break;
}
}
catch(IllegalArgumentException e){
System.out.println("Du lieu nhap vao khong hop le!");
}
}
public String getMaGV() {
return maGV;
}
public void hienThi() {
System.out.printf("\tMa so giang vien: %s\n", maGV);
System.out.printf("\tHo va ten: %s %s %s\n", this.hocVi.getTenVietTat(), hoGV, tenGV);
System.out.printf("\tGioi tinh: %s\n", this.gioiTinh.getTen());
System.out.printf("\tNgay thang nam sinh: %s\n", CauHinh.f.format(namSinh));
System.out.printf("\tHoc ham: %s\n", this.hocHam.getTen());
System.out.printf("\tHoc vi: %s\n", this.hocVi.getTen());
}
}