This project is a University Course Enrollment and Student Grading System built in Java. It demonstrates strong Object-Oriented Programming (OOP) design, robust exception handling, Java Collections, and Generics & Wildcards.
The system manages:
Student registration and profiles
Course registration and capacity management
Student enrollment in courses with duplicate prevention
Grade assignment with validation
Academic performance tracking and GPA calculation
Model real-world university entities using OOP principles
Enforce business rules through custom exception handling
Use Java Collections for data management and integrity
Implement Generic classes and Wildcard methods for type safety and reusability
Build an interactive menu-driven system with full input validation
UniversityEnrollmentSystem/
│
├── entities/
│ ├── Person.java (Abstract base class)
│ ├── Student.java (Student entity)
│ ├── Instructor.java (Instructor entity)
│ ├── Course.java (Course entity)
│ └── Enrollment.java (Links Student and Course)
│
├── exceptions/
│ ├── UniversitySystemException.java (Base custom exception)
│ ├── DuplicateEnrollmentException.java (Duplicate enrollment error)
│ ├── InvalidGradeException.java (Invalid grade error)
│ ├── StudentNotFoundException.java (Student not found error)
│ ├── CourseNotFoundException.java (Course not found error)
│ └── NotEnrolledException.java (Not enrolled error)
│
├── services/
│ ├── Repository.java (Generic interface)
│ ├── GenericRepository.java (Generic implementation)
│ ├── StudentService.java (Student business logic)
│ ├── CourseService.java (Course business logic)
│ └── EnrollmentService.java (Enrollment business logic)
│
└── Main.java (Interactive menu-driven entry point)
🧠 OOP Concepts Implemented
All fields are declared private
Access controlled through getters and setters
Input validation inside setter methods
Person is an abstract class
Contains abstract methods getRole() and displayInfo()
Forces subclasses to provide their own implementation
Student extends Person
Instructor extends Person
Reuses common properties like name, email, and ID
displayInfo() behaves differently for Student and Instructor
Demonstrated using a Person[] array in Main
Student HAS-MANY Enrollments (One-to-Many)
Course HAS-MANY Enrollments (One-to-Many)
Enrollment LINKS Student and Course (Many-to-Many Association)
Instructor HAS-MANY Courses (One-to-Many)
6. Separation of Concerns
Entity classes handle data only
Service classes handle business logic
Main class handles user interaction
Exception classes handle error reporting
Custom Exception Hierarchy
RuntimeException (Java built-in - Unchecked)
└── UniversitySystemException (Custom base exception)
├── DuplicateEnrollmentException
├── InvalidGradeException
├── StudentNotFoundException
├── CourseNotFoundException
└── NotEnrolledException
Rule
Exception Thrown
Student cannot enroll in the same course twice
DuplicateEnrollmentException
Grade must be between 0.0 and 5.0
InvalidGradeException
Cannot enroll non-existent student
StudentNotFoundException
Cannot enroll in non-existent course
CourseNotFoundException
Cannot grade a student not enrolled in the course
NotEnrolledException
Cannot enroll when course is full
UniversitySystemException
Cannot register duplicate student or course
UniversitySystemException
Collection
Where Used
Purpose
ArrayList
Student, Course, Enrollment lists
Ordered storage of entities
HashMap
GenericRepository
Fast O(1) lookup by ID
List interface
Service return types
Flexible collection handling
Optional
Repository findById
Safe null handling
public interface Repository <T > {
void add (T entity );
Optional <T > findById (String id );
List <T > findAll ();
boolean exists (String id );
}
public class GenericRepository <T > implements Repository <T > {
private Map <String , T > storage ;
// Works with Student, Course, or any entity type
}
public void addAll (List <? extends T > entities ) {
// Accepts any list of T or its subclasses
}
public void exportTo (List <? super T > destination ) {
// Exports to any list of T or its parent classes
}
Generic Methods with Predicates
public List <T > findWhere (Predicate <T > condition ) {
// Finds entities matching any condition
}
public int countWhere (Predicate <? super T > condition ) {
// Counts entities matching any condition
}
GPA Range
Letter Grade
Classification
4.5 - 5.0
A+
First Class Honours
4.0 - 4.4
A
First Class Honours
3.5 - 3.9
B+
Second Class Upper
3.0 - 3.4
B
Second Class Lower
2.5 - 2.9
C+
Second Class Lower
2.0 - 2.4
C
Pass
1.5 - 1.9
D
Pass
1.0 - 1.4
E
Fail
0.0 - 0.9
F
Fail
🖥️ Interactive Menu
╔════════════════════════════════════════════╗
║ MAIN MENU ║
╚════════════════════════════════════════════╝
1. Register Student
2. Register Course
3. Enroll Student in Course
4. Assign Grade to Student
5. View All Students
6. View All Courses
7. View Student Details
8. View Course Details
9. View Student Academic Summary
10. View System Statistics
0. Exit
Input Type
Validation Rules
Student ID
Cannot be empty
Student Name
Letters, spaces, and hyphens only
Email
Must contain '@' and '.' with valid format
Credit Hours
Must be between 1 and 6
Course Capacity
Must be between 1 and 100
Grade
Must be between 0.0 and 5.0
Menu Choice
Must be a valid number within range
▶️ How to Run the Project
Register 3 students
Register 2 courses
Enroll students in courses
Assign grades
View academic summaries and statistics
Test 2: Duplicate Enrollment Prevention
Register a student and a course
Enroll the student in the course
Try to enroll the same student in the same course again
System catches DuplicateEnrollmentException
Test 3: Course Full Prevention
Register a course with capacity of 2
Enroll 2 students successfully
Try to enroll a 3rd student
System catches UniversitySystemException with COURSE_FULL error
Test 4: Invalid Grade Prevention
Enroll a student in a course
Try to assign a grade above 5.0 or below 0.0
System catches InvalidGradeException
Test 5: Not Enrolled Prevention
Register a student and a course
Try to assign a grade without enrolling first
System catches NotEnrolledException
Test 6: Non-existent Entity Prevention
Try to enroll a non-existent student (e.g., ID: S999)
System catches StudentNotFoundException
Try to enroll in a non-existent course (e.g., Code: CS999)
System catches CourseNotFoundException
Java 8 or higher
No external libraries required
📈 Evaluation Criteria Coverage
Criteria
Marks
How It's Demonstrated
Class Design & Structure
2.5
5 entity + 5 service classes with clear responsibilities
Encapsulation
2.5
All fields private with controlled access
Inheritance & Abstraction
2.5
Person abstract class with Student and Instructor
Relationship Modeling
5
Student-Enrollment, Course-Enrollment, Instructor-Course
Separation of Concerns
2.5
Entity, Service, Exception, and Main layers
Custom Exceptions
0.5
6 custom exceptions with hierarchy
Correct Use of try-catch
1
All operations wrapped in proper try-catch
Validation & Error Triggers
1
Input validation before every operation
Clarity of Error Messages
0.5
Clear messages with error codes
Choice of Data Structures
1
HashMap for fast lookup and ArrayList for ordered data
Data Integrity
2
No duplicates and consistent state enforcement
Operations on Collections
1
Filter, search, iterate, add, and remove
Use in Real Context
1
Collections used realistically for academic records
Generic Classes/Methods
5
Repository interface and GenericRepository class
Type Safety
5
Compile-time type checking with no raw types
Wildcard Usage
5
Upper bounded and Lower bounded wildcards
Reusability
5
Same repository works for any entity type
University Course Enrollment System
Developed to demonstrate OOP, Exception Handling, Java Collections, and Generics & Wildcards
This project is for educational purposes only.