Files
Story-With-Thanh/J05041 - SẮP XẾP BẢNG TÍNH CÔNG.java
T
2022-12-15 23:51:04 +07:00

44 lines
1.3 KiB
Java

import java.util.*;
import java.text.*;
public class Main {
static int sup(String s){
if(s.compareTo("GD") == 0) return 250000;
else if(s.compareTo("PGD") == 0) return 200000;
else if(s.compareTo("TP") == 0) return 180000;
return 150000;
}
static class ob {
String code, name, cv;
int sal, days, plus, sup, sum;
public ob(int i, String name, int sal, int days, String cv){
code = "NV" + String.format("%02d", i);
this.name = name;
this.days = days;
this.sal = sal*days;
this.sup = sup(cv);
if(days>=25) plus = this.sal/5;
else if(days>=22) plus = this.sal/10;
else plus = 0;
sum = this.sal + this.sup + this.plus;
}
public String toString() {
return code+' '+name+" "+sal+" "+plus+" "+sup+" "+sum;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<ob> a = new ArrayList<>();
for(int i=0;i<n;i++){
sc.nextLine();
a.add(new ob(i+1, sc.nextLine(), sc.nextInt(), sc.nextInt(), sc.next()));
}
a.sort((ob x, ob y) -> y.sum - x.sum);
a.forEach(e -> System.out.println(e));
}
}