implement student and registration logic

This commit is contained in:
2026-06-09 17:42:47 +03:30
parent 8ddd529c85
commit 53c1bca954
3 changed files with 64 additions and 21 deletions
@@ -8,17 +8,26 @@ public class RegistrationSystem {
courses = new ArrayList<>();
}
public void addCourseToSystem(Course c) {
// TODO: Add the course to the system
public void addCourseToSystem(Course c) { // درس را به سیستم مرکزی اضافه می کند
if (!courses.contains(c)){
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
public Course findCourseByCode(String code) { // درس را بر اساس کد درس پیدا می کند
for ( Course c : courses){
if ( c.getCourseCode().equalsIgnoreCase(code)){
return c;
}
}
return null;
}
public void showAllCourses() {
// TODO: Print all courses in the system
public void showAllCourses() { // تمامی دروس ثبت شده در سیستم را نشان می دهد
System.out.println("لیست تمام دروس موجود در سیستم \n");
for(Course c : courses){
System.out.println("نام درس : " + c.getCourseName()+ "|کد درس :" + c.getCourseCode() + "| ظرفیت باقی مانده درس : " + c.getCapacity());
}
}
}