Full Mark - No Bonus - Late Submission
Workshop 02 - IntroToOOP
Course Registration System — Workshop Assignment
Overview
In this assignment, you will complete a partially implemented course registration system using Object-Oriented Programming (OOP) concepts in Java.
You are provided with starter code. Your task is to complete the missing parts marked with TODO.
What is Already Implemented
The following parts are already implemented for you:
Course Class
- Fields:
courseName,courseCode,capacity - Constructor
- Getter methods
- Methods for managing capacity:
reduceCapacity()increaseCapacity()
Student Class
- Fields and constructor
- Getter methods
RegistrationSystem Class
- Fields and constructor
Main Class
- Basic structure and instructions
Your Task (TODO Sections)
You must complete all methods marked with TODO.
Requirements
1. Student Class
Method: addCourse(Course c)
- Register the student in the course
- Only allow registration if the course has available capacity
- Reduce course capacity if registration is successful
- Return
trueif successful, otherwisefalse
Method: dropCourse(Course c)
- Remove the course from the student's registered list
- Increase course capacity after dropping
- Return
trueif the course was successfully removed, otherwisefalse
Method: showRegisteredCourses()
- Print all courses the student is registered in
- Display course name and course code
2. RegistrationSystem Class
Method: addCourseToSystem(Course c)
- Add the course to the system list
Method: findCourseByCode(String code)
- Search for a course using its course code
- Return the matching course if found
- Return
nullif no course is found
Method: showAllCourses()
- Print all courses in the system
- Include:
- course name
- course code
- remaining capacity
3. Main Class
You must complete the scenario in main:
- Create at least 3 courses
- Create one student
- Create a registration system
- Add courses to the system
- Register the student in some courses
- Drop one course
- Print final results
Example Scenario
Create the following:
Courses:
- Advanced Programming (AP1404, capacity 2)
- Data Structures (DS2201, capacity 1)
- Database Systems (DB3301, capacity 3)
Student:
- Name: Ali
- ID: 402222001
Expected actions:
- Register the student in 2 courses
- Drop 1 course
- Print:
- Student's registered courses
- Remaining capacity of all courses
Constraints
- Do NOT modify the
Courseclass - Do NOT remove existing method signatures
- You must use
ArrayList<Course> - Do NOT use public fields
Bonus (Optional)
- Prevent duplicate course registration
- Limit the number of courses per student
- Add search by course name
Workflow
-
Fork the repository to your own Git account
-
Clone your forked repository
-
Create a new branch named
develop:git checkout -b develop
-
Complete all TODO sections in the project
-
Commit your changes with meaningful commit messages
-
Push your branch to your repository:
git push origin develop
-
Create a Pull Request from
developtomain
Submission
- Submit the link to your Pull Request
- Your PR must be from
develop→main - Deadline: tomorrow night
- Your code must compile and run successfully