develop #2

Open
Fateme_Azizi wants to merge 6 commits from develop into main
Showing only changes of commit a4245b41a6 - Show all commits
@@ -9,16 +9,32 @@ public class RegistrationSystem {
} }
public void addCourseToSystem(Course c) { public void addCourseToSystem(Course c) {
// TODO: Add the course to the system
for (int i=0 ; i < courses.size() ; i++) {
if(courses.get(i).getCourseCode().equals(c.getCourseCode())) {
return;
}
}
courses.add(c);
} }
public Course findCourseByCode(String code) { public Course findCourseByCode(String code) {
// TODO: Search for a course by course code
// Return the matching course if found, otherwise return null for(int i=0 ; i < courses.size() ; i++) {
if(courses.get(i).getCourseCode().equals(code)) {
return courses.get(i);
}
}
return null; return null;
} }
public void showAllCourses() { public void showAllCourses() {
// TODO: Print all courses in the system for(int i=0 ; i < courses.size() ; i++) {
System.out.print("Course " + i+1 + ": ");
System.out.println(courses.get(i).getCourseName() + " " + courses.get(i).getCourseCode());
}
} }
} }