feat: Add comprehensive examples from multithreading and hashing lectures
This commit is contained in:
+16
-39
@@ -9,15 +9,11 @@ import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(
|
||||
String[] args)
|
||||
throws Exception {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Scanner scanner =
|
||||
new Scanner(System.in);
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
StudentManager manager =
|
||||
new StudentManager();
|
||||
StudentManager manager = new StudentManager();
|
||||
|
||||
while (true) {
|
||||
|
||||
@@ -29,17 +25,13 @@ public class Main {
|
||||
5.Exit
|
||||
""");
|
||||
|
||||
int choice =
|
||||
scanner.nextInt();
|
||||
int choice = scanner.nextInt();
|
||||
|
||||
switch (choice) {
|
||||
|
||||
case 1 -> {
|
||||
|
||||
List<String> data =
|
||||
FileManager
|
||||
.loadStudents(
|
||||
"students.txt");
|
||||
List<String> data = FileManager.loadStudents("students.txt");
|
||||
|
||||
// TODO:
|
||||
|
||||
@@ -53,14 +45,11 @@ public class Main {
|
||||
|
||||
// TODO:
|
||||
|
||||
StudentLoader t1 =
|
||||
null;
|
||||
StudentLoader t1 = null;
|
||||
|
||||
StudentLoader t2 =
|
||||
null;
|
||||
StudentLoader t2 = null;
|
||||
|
||||
StudentLoader t3 =
|
||||
null;
|
||||
StudentLoader t3 = null;
|
||||
|
||||
// TODO:
|
||||
|
||||
@@ -74,40 +63,28 @@ public class Main {
|
||||
|
||||
case 2 -> {
|
||||
|
||||
System.out.print(
|
||||
"ID: ");
|
||||
System.out.print("ID: ");
|
||||
|
||||
int id =
|
||||
scanner.nextInt();
|
||||
int id = scanner.nextInt();
|
||||
|
||||
System.out.println(
|
||||
manager
|
||||
.searchStudent(
|
||||
id));
|
||||
System.out.println(manager.searchStudent(id));
|
||||
|
||||
}
|
||||
|
||||
case 3 -> {
|
||||
|
||||
System.out.print(
|
||||
"ID: ");
|
||||
System.out.print("ID: ");
|
||||
|
||||
int id =
|
||||
scanner.nextInt();
|
||||
int id = scanner.nextInt();
|
||||
|
||||
boolean removed =
|
||||
manager
|
||||
.removeStudent(
|
||||
id);
|
||||
boolean removed = manager.removeStudent(id);
|
||||
|
||||
System.out.println(
|
||||
removed);
|
||||
System.out.println(removed);
|
||||
|
||||
}
|
||||
|
||||
case 4 ->
|
||||
manager
|
||||
.printStudents();
|
||||
manager.printStudents();
|
||||
|
||||
case 5 -> {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user