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

This commit is contained in:
2026-05-03 09:29:23 +00:00
parent a2c24fe3cc
commit 636a3277c6
+5 -4
View File
@@ -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();
}
}