Update src/main/java/services/SchoolSystem.java

This commit is contained in:
2026-05-03 09:29:23 +00:00
parent a2c24fe3cc
commit 636a3277c6
+7 -6
View File
@@ -16,7 +16,7 @@ public class SchoolSystem {
}
// ========== Student Management ==========
//TODO
//TODO
// ========== Teacher Management ==========
public boolean registerTeacher(String username, String password) {
@@ -44,7 +44,7 @@ public class SchoolSystem {
// ========== Course Management ==========
public boolean addCourseToSystem(String courseName) {
//TODO
//TODO
return true;
}
@@ -60,14 +60,15 @@ public class SchoolSystem {
return null;
}
public void showAllCourses() {
public String getAllCoursesDisplay() {
if (allCourses.isEmpty()) {
System.out.println(" No courses available yet.");
return " No courses available yet.";
} else {
System.out.println("\n All Available Courses:");
StringBuilder sb = new StringBuilder("\n All Available Courses:\n");
for (int i = 0; i < allCourses.size(); i++) {
System.out.println(" " + (i+1) + ". " + allCourses.get(i));
sb.append(" ").append(i+1).append(". ").append(allCourses.get(i)).append("\n");
}
return sb.toString();
}
}