Files
Story-With-Thanh/J05021 - SẮP XẾP THEO MÃ SINH VIÊN.java
T
2022-12-15 23:51:04 +07:00

52 lines
1.4 KiB
Java

import java.util.*;
public class Main {
static char up(char x) {
if ('a' <= x && x <= 'z')
return (char) ((int) x - 32);
return x;
}
static String re(String name) {
String[] a = name.split("[' ']+");
String r = "";
for (int i = 0; i < a.length; i++) {
if (a[i].length() == 0)
continue;
String s = Character.toString(up(a[i].charAt(0))) + a[i].substring(1);
r += s + " ";
}
return r;
}
static class student {
String code, name, method, mail;
public student(String c, String n, String m, String em) {
code = c;
name = n;
method = m;
mail = em;
}
public boolean big(student b) {
if (code.compareTo(b.code) > 0)
return true;
return false;
}
public String toString() {
return code + " " + name + ' ' + method + " " + mail;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<student> a = new ArrayList<>();
while(sc.hasNextLine()) a.add(new student(sc.nextLine(), sc.nextLine(), sc.nextLine(), sc.nextLine()));
a.sort((student x, student y) ->{
return x.code.compareTo(y.code);
});
a.forEach(e->System.out.println(e));
}
}