Mid Lab Report
Mid Lab Report
Submitted by:
Objective:
The primary goal of this project is to implement a simple university course management
system using Java principles of inheritance and composition. This system models people
(professors and students), their relationship to courses, and the overall structure of the
university.
The Person class serves as a superclass for all individuals in the system. It includes basic
personal information:
String name
int age
String email
String studentId
String major
public Student(String name, int age, String email, String studentId, String major) {
super(name, age, email);
this.studentId = studentId;
this.major = major;
}
String employeeId
String department
public Professor(String name, int age, String email, String employeeId, String department) {
super(name, age, email);
this.employeeId = employeeId;
this.department = department;
}
String courseCode
String courseTitle
Professor instructor (has-a relationship)
List<Student> enrolledStudents (composition)
import java.util.ArrayList;
import java.util.List;
List<Course> courses
import java.util.ArrayList;
import java.util.List;
public University() {
courses = new ArrayList<>();
}
Functionality:
Sample Output:
Course Code: CS101, Title: Object Oriented Programming
Instructor: Name: Bushra Naz, Age: 35, Email: bushranaz@comsats.edu.pk
Employee ID: PRO123, Department: Computer Science
Enrolled Students:
Name: Mubashir, Age: 20, Email: mubashir@email.com
Student ID: STD001, Major: CS
Name: Hassan, Age: 21, Email: mubashir@email.com
Student ID: STD002, Major: CS
Conclusion: