Update lab4
This commit is contained in:
parent
511422ad6c
commit
1f0c160216
6
lab4
6
lab4
|
@ -44,7 +44,7 @@ public class Lab4 {
|
||||||
|
|
||||||
int C11 = 2430 % 11;
|
int C11 = 2430 % 11;
|
||||||
System.out.println("\n ----------------------------------------------------------------------------------------------------------");
|
System.out.println("\n ----------------------------------------------------------------------------------------------------------");
|
||||||
System.out.println(" C17 = " + C11 + ", So, the task is: Define the student class, which consists of at least 5 fields.");
|
System.out.println(" C11 = " + C11 + ", So, the task is: Define the student class, which consists of at least 5 fields.");
|
||||||
System.out.println(" ----------------------------------------------------------------------------------------------------------");
|
System.out.println(" ----------------------------------------------------------------------------------------------------------");
|
||||||
|
|
||||||
Student[] students = {
|
Student[] students = {
|
||||||
|
@ -80,7 +80,7 @@ public class Lab4 {
|
||||||
System.out.println("Invalid sort order! Please enter 'asc' or 'desc'.");
|
System.out.println("Invalid sort order! Please enter 'asc' or 'desc'.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comparator<Student> comparator = null;
|
Comparator<Student> comparator = null;
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case "greed book":
|
case "greed book":
|
||||||
|
@ -103,7 +103,7 @@ public class Lab4 {
|
||||||
comparator = comparator.reversed();
|
comparator = comparator.reversed();
|
||||||
}
|
}
|
||||||
Arrays.sort(students, comparator);
|
Arrays.sort(students, comparator);
|
||||||
|
|
||||||
System.out.println("\nSorted by " + field + " (in " + order + "ending order):");
|
System.out.println("\nSorted by " + field + " (in " + order + "ending order):");
|
||||||
System.out.println(String.format("%n%-15s | %-20s | %-4s | %-4s | %-10s", "Greed book", "Name", "Age", "GPA", " Faculty"));
|
System.out.println(String.format("%n%-15s | %-20s | %-4s | %-4s | %-10s", "Greed book", "Name", "Age", "GPA", " Faculty"));
|
||||||
System.out.println("----------------------------------------------------------------");
|
System.out.println("----------------------------------------------------------------");
|
||||||
|
|
Loading…
Reference in New Issue