https://github.com/saeedmosaffer/schoolmanagementsystem_saeedmosaffer
https://github.com/saeedmosaffer/schoolmanagementsystem_saeedmosaffer
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/saeedmosaffer/schoolmanagementsystem_saeedmosaffer
- Owner: saeedmosaffer
- Created: 2024-12-13T16:12:38.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-21T13:31:21.000Z (over 1 year ago)
- Last Synced: 2025-02-22T12:30:58.805Z (over 1 year ago)
- Language: C#
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SchoolManagementSystem_SaeedMosaffer
The code was done as required with these changes and additions:
I created an Affiliate class with the common attributes between the student and the teacher
In the student class, I added a method to delete the course as well
In the data structure, I used the following:
for students, teachers, and courses im used Dictionary
For courses associated with students and teachers, im used HashSet to avoid duplicates while maintaining efficient insertion and deletion.
Data Structure: Dictionary.
Reason: If you need to find a student, teacher, or course by their Id frequently, a dictionary provides O(1) average lookup time
Data Structure: HashSet.
Reason: HashSet if you need to ensure no duplicate entries (e.g., a student can't enroll in the same course twice).
In the course class, I added two methods, which are as follows:
Equals Method:
This method is used to determine equality between two Course objects.
It checks if the given object (obj) is a Course and compares their Id values.
This ensures that two Course objects are considered equal if they have the same ID, regardless of other properties.
GetHashCode Method:
This method generates a hash code for the Course object, which is used in hash-based collections like HashSet and Dictionary.
The hash code is derived from the Id property, ensuring that the Id uniquely identifies the object in collections.