Update src/main/java/Main.java

This commit is contained in:
2026-05-03 09:29:49 +00:00
parent 636a3277c6
commit 3618726133
+9 -8
View File
@@ -135,13 +135,13 @@ public class Main {
switch (choice) {
case 1:
school.showAllCourses();
System.out.print(school.getAllCoursesDisplay());
break;
case 2:
enrollInCourse(student);
break;
case 3:
//student.showMyCourses();
//System.out.print(student.getMyCoursesDisplay());
break;
case 4:
System.out.println(" Goodbye, " + student.getUsername() + "!");
@@ -174,13 +174,13 @@ public class Main {
switch (choice) {
case 1:
school.showAllCourses();
System.out.print(school.getAllCoursesDisplay());
break;
case 2:
addNewCourseToSystem(teacher);
break;
case 3:
teacher.showMyCourses();
System.out.print(teacher.getMyCoursesDisplay());
break;
case 4:
addCourseToTeacher(teacher);
@@ -216,7 +216,7 @@ public class Main {
}
private static void addCourseToTeacher(Teacher teacher) {
school.showAllCourses();
System.out.print(school.getAllCoursesDisplay());
System.out.print("\nEnter Course ID to add to your list: ");
int courseId = getIntInput();
@@ -234,7 +234,7 @@ public class Main {
}
private static void removeCourseFromTeacher(Teacher teacher) {
teacher.showMyCourses();
System.out.print(teacher.getMyCoursesDisplay());
if (teacher.getMyCourses().isEmpty()) return;
System.out.print("\nEnter Course ID to remove from your list: ");
@@ -254,7 +254,7 @@ public class Main {
}
private static void showStudentsInTeacherCourse(Teacher teacher) {
teacher.showMyCourses();
System.out.print(teacher.getMyCoursesDisplay());
if (teacher.getMyCourses().isEmpty()) return;
System.out.print("\nEnter Course ID to see students: ");
@@ -266,7 +266,8 @@ public class Main {
return;
}
teacher.showStudentsInCourse(course);
String result = teacher.getStudentsDisplayForCourse(course);
System.out.println(result);
}
private static int getIntInput() {