implement student and registration logic
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user