-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJ05038_BangKeTienLuong.java
70 lines (63 loc) · 1.9 KB
/
J05038_BangKeTienLuong.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
import java.util.*;
import java.math.*;
import java.io.*;
class NhanVien {
private String name, cv, id;
private int lt, t, pc, tt, snc, ln;
public NhanVien(int i, String name, int ln, int snc, String cv) {
if (i < 10) {
this.id = "NV0" + i;
} else {
this.id = "NV" + i;
}
this.name = name;
this.ln = ln;
this.snc = snc;
this.cv = cv;
this.lt = snc * ln;
this.t = 0;
if (snc >= 25) {
this.t = lt * 20 / 100;
} else if (snc >= 22) {
this.t = lt * 10 / 100;
}
this.pc = 150000;
if (cv.equals("GD")) {
this.pc = 250000;
} else if (cv.endsWith("PGD")) {
this.pc = 200000;
} else if (cv.endsWith("TP")) {
this.pc = 180000;
}
this.tt = this.lt + this.t + this.pc;
}
public int getLuong() {
return this.tt;
}
@Override
public String toString() {
return this.id + " " + this.name + " " + this.lt + " " + this.t + " " + this.pc + " " + this.tt;
}
}
public class J05038_BangKeTienLuong {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
ArrayList<NhanVien> a = new ArrayList<>();
int sum = 0;
for (int i = 1; i <= n; i++) {
String name = sc.nextLine();
int luong = sc.nextInt();
int soNgayCong = sc.nextInt();
sc.nextLine();
String chucvu = sc.nextLine();
a.add(new NhanVien(i, name, luong, soNgayCong, chucvu));
}
for (NhanVien nv : a) {
System.out.println(nv);
sum += nv.getLuong();
}
System.out.println("Tong chi phi tien luong: " + sum);
}
}