complete all TODO sections

This commit is contained in:
2026-04-20 20:48:20 +03:30
parent 8ddd529c85
commit c0c283e0c5
3 changed files with 139 additions and 19 deletions
@@ -9,16 +9,35 @@ public class RegistrationSystem {
}
public void addCourseToSystem(Course c) {
// TODO: Add the course to the system
courses.add(c);
}
public Course findCourseByCode(String code) {
// TODO: Search for a course by course code
// Return the matching course if found, otherwise return null
for (Course a : courses)
{
if (a.getCourseCode().equals(code))
{
return a;
}
}
return null;
}
public Course findCourseByName(String name)
{
for (Course a : courses)
{
if (a.getCourseName().equals(name))
{
return a;
}
}
return null;
}
public void showAllCourses() {
// TODO: Print all courses in the system
for (Course c : courses)
{
System.out.println(c.getCourseName() + " - " + c.getCourseCode() + " - capacity: " + c.getCapacity());
}
}
}