0% found this document useful (0 votes)
16 views7 pages

University Course Management System in Java

The document is a mid lab report on a project titled 'University Course Management System using Java', submitted by M Mubashir Hassan. It outlines the implementation of a course management system using object-oriented programming principles, including classes for Person, Student, Professor, Course, and University, demonstrating inheritance and composition. The project successfully models the relationships between professors, students, and courses, while showcasing key object-oriented concepts such as encapsulation and abstraction.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

University Course Management System in Java

The document is a mid lab report on a project titled 'University Course Management System using Java', submitted by M Mubashir Hassan. It outlines the implementation of a course management system using object-oriented programming principles, including classes for Person, Student, Professor, Course, and University, demonstrating inheritance and composition. The project successfully models the relationships between professors, students, and courses, while showcasing key object-oriented concepts such as encapsulation and abstraction.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Mid Lab Report

Object Orientied Programming

Submitted by:

Name: M Mubashir Hassan


Roll No: FA23-BAI-034
Department: Computer Science
Semester: IV
Course: Object-Oriented Programming
Instructor: MAM Bushra Naz
Date: 29April,2025
Project Title:

University Course Management System using Java

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.

Classes and Structure:

1. Person (Base Class)

The Person class serves as a superclass for all individuals in the system. It includes basic
personal information:

 String name
 int age
 String email

public class Person {


protected String name;
protected int age;
protected String email;

public Person(String name, int age, String email) {


[Link] = name;
[Link] = age;
[Link] = email;
}

public void displayInfo() {


[Link]("Name: " + name + ", Age: " + age + ", Email: " + email);
}
}

2. Student (Subclass of Person)


Inherits from Person and includes:

 String studentId
 String major

public class Student extends Person {

private String studentId;


private String major;

public Student(String name, int age, String email, String studentId, String major) {
super(name, age, email);
[Link] = studentId;
[Link] = major;
}

public void displayStudent() {


displayInfo();
[Link]("Student ID: " + studentId + ", Major: " + major);
}

public String getStudentId() {


return studentId;
}
}

3. Professor (Subclass of Person)


Inherits from Person and includes:

 String employeeId
 String department

public class Professor extends Person {


private String employeeId;
private String department;

public Professor(String name, int age, String email, String employeeId, String department) {
super(name, age, email);
[Link] = employeeId;
[Link] = department;
}

public void displayProfessor() {


displayInfo();
[Link]("Employee ID: " + employeeId + ", Department: " + department);
}
}

4. Course (Composition Class)

The Course class models a course offered at the university. It contains:

 String courseCode
 String courseTitle
 Professor instructor (has-a relationship)
 List<Student> enrolledStudents (composition)

import [Link];
import [Link];

public class Course {


private String courseCode;
private String courseTitle;
private Professor instructor;
private List<Student> enrolledStudents;

public Course(String courseCode, String courseTitle, Professor instructor) {


[Link] = courseCode;
[Link] = courseTitle;
[Link] = instructor;
[Link] = new ArrayList<>();
}

public void enrollStudent(Student student) {


[Link](student);
}

public void displayCourse() {


[Link]("Course Code: " + courseCode + ", Title: " + courseTitle);
[Link]("Instructor: ");
[Link]();
[Link]("Enrolled Students:");
for (Student student : enrolledStudents) {
[Link]();
}
}
}

5. University (Composition Class)

The University class holds a list of all offered courses:

 List<Course> courses
import [Link];
import [Link];

public class University {


private List<Course> courses;

public University() {
courses = new ArrayList<>();
}

public void addCourse(Course course) {


[Link](course);
}

public void displayCourses() {


for (Course course : courses) {
[Link]();
[Link]("-----");
}
}
}

Functionality:

 Professors can be assigned as instructors to a course.


 Students can be enrolled in a course.
 The system maintains and displays information on all university courses, including
instructors and enrolled students.

Object-Oriented Concepts Used:

 Inheritance: Student and Professor classes inherit from Person.


 Composition: Course has a Professor and a list of Student objects. University
contains a list of Course objects.
 Encapsulation: Data is protected through appropriate use of access modifiers and
public methods.
 Abstraction: Real-world entities are abstracted into classes and relationships.

Sample Output:
Course Code: CS101, Title: Object Oriented Programming
Instructor: Name: Bushra Naz, Age: 35, Email: bushranaz@[Link]
Employee ID: PRO123, Department: Computer Science
Enrolled Students:
Name: Mubashir, Age: 20, Email: mubashir@[Link]
Student ID: STD001, Major: CS
Name: Hassan, Age: 21, Email: mubashir@[Link]
Student ID: STD002, Major: CS

Conclusion:

This project successfully demonstrates object-oriented programming concepts to design a


modular, extendable university system. The use of inheritance and composition allows for
future expansion, such as adding grades, attendance, or administration modules.

Common questions

Powered by AI

Integrating a grading module into the current design might face challenges related to the level of abstraction and data flow management. With grades likely being assigned to students within specific course contexts, the current Course class would require significant modifications to track individual student performance, including potentially extensive changes to existing data structures. Ensuring all relevant entities interact seamlessly to manage, update, and display grades might require additional classes or methods, posing challenges in maintaining the system's simplicity and cohesion. Furthermore, ensuring data privacy and appropriate access controls would add complexity to encapsulating and securing grading-related data .

The system's use of object-oriented principles such as inheritance, encapsulation, and composition provides a robust foundation for scalable and extensible architecture. Inheritance allows new classes to be easily added by extending existing ones, and common behaviors can be inherited, reducing redundancy. Composition facilitates the addition of new features, like additional properties or relationships, without altering existing classes. By keeping data and functionalities encapsulated, changes to one part of the system minimally affect others, which is essential for implementing future functionalities such as grades or attendance modules .

Composition is used in the system by including objects of one class within another. The Course class includes a Professor object as an instructor and a List of Student objects as enrolled students. This allows Courses to be composed of these entities, reflecting real-world relationships. The University class, composed of a list of courses, can manage multiple course instances. This design promotes modularity and maintainability, as objects can be composed and decomposed easily, enabling flexible system expansion and coupling .

The primary classes in the university course management system are Person, Student, Professor, Course, and University. Person serves as a base class for Student and Professor, providing common attributes. Student extends Person by adding student-specific information like studentId and major. Similarly, Professor extends Person with employeeId and department details. The Course class comprises a Professor as an instructor and a List of Students enrolled, demonstrating composition. The University class encapsulates a list of Courses, overseeing all course interactions, which include associating professors and enrolling students in courses .

Utilizing a 'List' to manage enrolled students ensures flexible and dynamic handling of student data, allowing for easy addition or removal of students from a course. This enhances functionality by supporting size variability and providing built-in methods for operations like iteration, which are critical for displaying student data. Performance-wise, while a List efficiently manages small to medium datasets, scalability might be challenged if the number of students grows significantly, due to potential increases in operation time for adding or searching for items. Nevertheless, it offers a balanced approach for moderate-scale applications such as a university system .

Abstraction in this system is implemented by modeling real-world entities such as students, professors, and courses as classes. Each class captures essential features and behaviors relevant to the system's operation while omitting less pertinent details. This simplifies complexity by focusing only on the necessary components needed to support functionality, like managing course enrollments or displaying information. The main benefit of this abstraction is improved system clarity and maintainability, as developers can understand and manage each class as a high-level conceptual entity, which aligns with its usage in the real-world university setting .

The concept of inheritance enhances the structure of the university course management system by allowing the classes Student and Professor to inherit common attributes such as name, age, and email from the base class Person. This promotes code reuse, reduces redundancy, and simplifies maintenance by centralizing common data and behavior in the superclass. It also aligns with real-world hierarchies, making the system design more intuitive and easier to scale .

The system employs encapsulation through the use of access modifiers, such as 'private' for attribute visibility and 'public' methods for controlled data access and modification. This approach ensures that the internal state of each class is protected from unauthorized access and accidental alteration, thus enhancing security. Specifically, it restricts direct access to attributes of Person and its subclasses, as well as to those encapsulated within the Course and University classes. This not only secures the data but also aligns with the principle of data hiding, where interaction with the class data is only possible through defined interfaces .

The University class serves as an overarching structure that manages a collection of courses. It contains a List of Course objects, allowing it to add new courses and display the complete course catalogue, including the professor and students associated with each course. This centralized management simplifies the handling of multiple courses, making the system more organized and facilitating operations like enrollment updates or course listings. Additionally, it enhances system versatility by providing a singular entity to streamline interactions with all courses within the university .

Professors are assigned to courses through a 'has-a' relationship implemented via composition, wherein the Course class contains a Professor object as its instructor. This design not only simplifies the association and management of instructor assignments but also supports system extensions. For example, additional attributes or functions related to instructing, such as schedules or evaluations, can be integrated into the Professor class or associated with the Course. Such extensions maintain coherent data structures and functional interactions within the system's compositional framework .

You might also like