-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQLDV.java
More file actions
139 lines (120 loc) · 5.66 KB
/
QLDV.java
File metadata and controls
139 lines (120 loc) · 5.66 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
package qldv;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class QLDV {
public static void main(String[] args) {
int n=12;
String ThongTin[];
List<Person> CanBo = new ArrayList<Person>();
while(n != 0){
Scanner sc = new Scanner(System.in);
System.out.println("*********** MENU ***********");
System.out.println("1.THÊM MỚI CÁN BỘ");
System.out.println("2.TÌM KIẾM THEO TÊN");
System.out.println("3.TÍNH LƯƠNG");
System.out.println("4.THÔNG TIN CÁN BỘ");
System.out.println("0.THOÁT");
System.out.print("Chọn chức năng : ");
n = sc.nextInt();
if(n==0){
System.out.println("Kết thúc chương trình");
break;
}
if(n==1){
int m;
System.out.println("Chọn đối tượng");
System.out.println("1.Công nhân");
System.out.println("2.Bảo vệ");
System.out.println("3.Kĩ sư");
m = sc.nextInt();
if(m==1){
Worker worker = new Worker() ;
CanBo.add(worker);
worker.Run();
}
else if(m==2){
Security security = new Security() ;
CanBo.add(security);
security.Run();
}
else if(m==3){
Engineer engineer = new Engineer() ;
CanBo.add(engineer);
engineer.Run();
}
}
if(n==2){
if(CanBo.isEmpty()) System.out.println("HÃY NHẬP THÔNG TIN CÁN BỘ");
else{
String s;
System.out.print("Tìm kiếm: ");
sc.nextLine();
s = sc.nextLine();
List <Person> result2 = CanBo.stream()
.filter(x -> s.equals(x.getName()))
.collect(Collectors.toList());
for(int i=0; i< result2.size(); i++){
result2.get(i).showInformation();
}
System.out.print("\n\n");
}
}
if(n==3){
int bac, namkn, cong, hsluong;
double luong;
System.out.println("\nTHÊM THÔNG TIN");
System.out.print("Bậc (nếu có): ");
bac = sc.nextInt();
if(bac==0) bac=1;
System.out.print("Số năm kinh nghiệm (nếu có): ");
namkn = sc.nextInt();
if(namkn==0) namkn=1;
System.out.print("Số ngày công: ");
cong = sc.nextInt();
System.out.print("Hệ số lương: ");
hsluong = sc.nextInt();
System.out.println("=> Lương: " + (bac*namkn*cong*hsluong) +"\n\n");
}
if(n==4){
int m;
System.out.println("Chọn đối tượng");
System.out.println("1.Công nhân");
System.out.println("2.Bảo vệ");
System.out.println("3.Kĩ sư");
m = sc.nextInt();
if(m==1){
if(CanBo.isEmpty()) System.out.println("KHÔNG CÓ DỮ LIỆU\n\n");
else{
for(Person worker : CanBo){
if(worker.getSetial().startsWith("CN")) {
worker.showInformation();
}
}
}
}
if(m==2){
if(CanBo.isEmpty()) System.out.println("KHÔNG CÓ DỮ LIỆU\n\n");
else{
for(Person security : CanBo){
if(!security.getSetial().startsWith("BV")) {
security.showInformation();
}
}
}
}
if(m==3){
if(CanBo.isEmpty()) System.out.println("KHÔNG CÓ DỮ LIỆU\n\n");
else{
for(Person engineer : CanBo){
if(engineer.getSetial().startsWith("KS"))
engineer.showInformation();
}
}
}
}
}
}
}