Files
Workshop-2/README.md
T
2026-04-19 15:27:44 +00:00

168 lines
3.3 KiB
Markdown

# 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 `true` if successful, otherwise `false`
---
#### Method: `dropCourse(Course c)`
- Remove the course from the student's registered list
- Increase course capacity after dropping
- Return `true` if the course was successfully removed, otherwise `false`
---
#### 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 `null` if 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 `Course` class
- 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
1. Fork the repository to your own Git account
2. Clone your forked repository
3. Create a new branch named `develop`:
git checkout -b develop
4. Complete all TODO sections in the project
5. Commit your changes with meaningful commit messages
6. Push your branch to your repository:
git push origin develop
7. Create a Pull Request from `develop` to `main`
---
## 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