36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
package CourseRegistrationStarter;
|
|
|
|
public class Main {
|
|
public static void main(String[] args) {
|
|
// 1. Create courses
|
|
Course c1 = new Course("Advanced Programming", "AP1404", 2);
|
|
Course c2 = new Course("Data Structures", "DS2201", 1);
|
|
Course c3 = new Course("Database Systems", "DB3301", 3);
|
|
|
|
// 2. Create student
|
|
Student student = new Student("Ali", "402222001");
|
|
|
|
// 3. Create registration system
|
|
RegistrationSystem system = new RegistrationSystem();
|
|
|
|
// 4. Add courses to system
|
|
system.addCourseToSystem(c1);
|
|
system.addCourseToSystem(c2);
|
|
system.addCourseToSystem(c3);
|
|
|
|
// 5. Register student in courses
|
|
student.addCourse(system.findCourseByCode("AP1404"));
|
|
student.addCourse(system.findCourseByCode("DS2201"));
|
|
|
|
// 6. Drop one course
|
|
student.dropCourse(system.findCourseByCode("DS2201"));
|
|
|
|
// 7. Print final results
|
|
System.out.println("===== FINAL STUDENT COURSES =====");
|
|
student.showRegisteredCourses();
|
|
|
|
System.out.println("\n===== SYSTEM COURSES =====");
|
|
system.showAllCourses();
|
|
}
|
|
}
|