-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ04015.java
More file actions
43 lines (36 loc) · 1.12 KB
/
J04015.java
File metadata and controls
43 lines (36 loc) · 1.12 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
import java.util.*;
//src/GiaoVien.java
class GiaoVien {
private String ma;
private String role;
private int heSo;
private String name;
private int salary;
private int phuCap;
public GiaoVien(String ma, String name, int salary) {
this.ma = ma;
this.role = ma.substring(0, 2);
this.heSo = Integer.parseInt(ma.substring(2));
this.name = name;
this.salary = salary;
}
public String toString() {
if (this.role.equals("HT")) {
this.phuCap = 2000000;
} else if (this.role.equals("HP")) {
this.phuCap = 900000;
} else {
this.phuCap = 500000;
}
int tmp = this.heSo * this.salary + this.phuCap;
return this.ma + " " + this.name + " " + this.heSo + " " + (int) this.phuCap + " " + tmp;
}
}
//src/J04015.java
public class J04015 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
GiaoVien x = new GiaoVien(sc.nextLine(), sc.nextLine(), sc.nextInt());
System.out.println(x);
}
}