KEMBAR78
Se Lab Manual Final Report | PDF | Use Case | Unified Modeling Language
0% found this document useful (0 votes)
31 views49 pages

Se Lab Manual Final Report

The document outlines the curriculum and objectives of the Software Engineering course at Chennai Institute of Technology, focusing on developing key skills in software systems. It includes a series of experiments aimed at creating a Learning Management System (LMS), detailing the requirements, use cases, and design diagrams necessary for its implementation. The mission of the Computer Science and Engineering department emphasizes nurturing ethical values and fostering innovation among students to meet societal needs.

Uploaded by

santhosh.ibk8
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)
31 views49 pages

Se Lab Manual Final Report

The document outlines the curriculum and objectives of the Software Engineering course at Chennai Institute of Technology, focusing on developing key skills in software systems. It includes a series of experiments aimed at creating a Learning Management System (LMS), detailing the requirements, use cases, and design diagrams necessary for its implementation. The mission of the Computer Science and Engineering department emphasizes nurturing ethical values and fostering innovation among students to meet societal needs.

Uploaded by

santhosh.ibk8
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
You are on page 1/ 49

CHENNAI INSTITUTE OF TECHNOLOGY

Sarathy Nagar, Kundrathur, Chennai-600069


An Autonomous Institute Approved by AICTE and Affiliated to Anna University,
Chennai

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CS3405 – SOFTWARE ENGINEERING

Department of Computer Science and Engineering

By
Name: HARSHIVKRISHNA M
Reg.NO: 23CS064

APRIL - 2025

CHENNAI INSTITUTE OF
TECHNOLOGY CHENNAI-
69
e Institute:

eminent center for Academia, Industry and Research by imparting knowledge, relevantpractices and
inculcating human values to address global challenges through novelty and
sustainability

he Institute:

IM1.Tocreatenextgenerationleadersbyeffectiveteachinglearningmethodologiesandinstil
l scientific sparkin them to meet the global challenges.
IM2.To transform lives through deployment of emerging technology, novelty and
sustainability.
ulcatehumanvaluesandethicalprinciplestocatertothesocietalneeds.
IM4.Tocontributetowardstheresearchecosystembyprovidingasuitable,effective
platformforinteractionbetweenindustry,academiaandR&Destablishments.
tureincubationcentersenablingstructuredentrepreneurshipandstart-ups.
Department of Computer Science and Engineering

Vision of the Department:

To Excel in the emerging areas of Computer Science and Engineering by


impartingknowledge,relevantpracticesand inculcating humanvaluesto transformthe
studentsas potential resources to contribute innovatively through advanced
computing in realtime situations.

Mission of the Department:

DM1:ToprovidestrongfundamentalsandtechnicalskillsforComputerScience
applications through effective teaching learning methodologies.

DM2: Totransform lives of thestudentsbynurturing ethicalvalues, creativity and


novelty to become Entrepreneurs and establish start-ups.

DM3:Tohabituatethestudentstofocusonsustainablesolutionstoimprovethe quality
of life and the welfare of the society.

DM4:Toenhancethefabricofresearchincomputingthroughcollaborative linkages
with industry and academia.

DM5: Toinculcatelearningoftheemergingtechnologiestopursuehigher
studies leading to lifelong learning.
Register No:

BONAFIDE CERTIFICATE
Certified that this is the bonafide record of work
done by Mr./Ms
.......................................................................................
of
………semester B.E...........................................................
Engineering in the …………………………………………
Laboratory during the academic year
……............................

Staff-In-Charge Head of the Department

Submitted for the University Practical Examination held


on……………………….

Internal Examiner External Examiner


Date: ……………………. Date: …………….............
4
INDEX
S.No. Date Title of the Project Pag CO’s PO’s, PS0’s Signature
e Mapped Mapped
No.
1 Identify a software system that
needs to be developed.
2 Document the Software
Requirements Specification (SRS)
for the identified system
3 Identify use cases and develop the
Use Case model.
4 Identify the conceptual classes
and develop a Domain Model
and also derive a Class Diagram
from that.
5 Using the identified scenarios,
find the interaction between
objects and represent them using
UML Sequence and Collaboration
Diagrams
6 Draw relevant State Chart and
Activity Diagrams for the same
system.
7 Implement the system as per the
detailed design
8 Test the software system for all
the scenarios identified as per the
use case diagram
9 Improve the reusability and
maintainability of the software
system by applying appropriate
design patterns

5
Expt.No:1
Date: IDENTIFICATION OF SOFTWARE SYSTEM

AIM:
To identify and analyze a software system by understanding its requirements, components,
architecture, functionalities, and interactions.

THEORY:
The problem statement is the initial starting point for a project. It is basically a one to
three page statement that everyone on the project agrees with that describes what will be done at
a high level. The problem statement is intended for a broad audience and should be written in
nontechnical terms. It helps the non-technical and technical personnel communicate by
providing a description of a problem. It doesn't describe the solution to the problem. The input
to requirement engineering is the problem statement prepared by customer. It may give an
overview of the existing system along with broad expectations from the new system. The first
phase of requirements engineering begins with requirements elicitation i.e. gathering of
information about requirements. Here, requirements are identified with the help of customer and
existing system processes. So from here begins the preparation of problem statement. So,
basically a problem statement describes what needs to be done without describing how.

SAMPLE PROBLEM STATEMENT:

Develop a Student Information System (SIS) to automate the management of student


records, including personal details, course enrollments, academic performance, and attendance.
The system will streamline administrative tasks, reduce errors, and provide real-time data access
for students, faculty, and staff, enhancing efficiency in handling and reporting student
information.

PROBLEM STATEMENT

Develop a Learning Management System (LMS) to facilitate online course creation, content
delivery, student progress tracking, and assessment management. The system will automate
enrollment, provide interactive learning resources, and support real-time communication
between instructors and learners. It aims to enhance accessibility, engagement, and
performance monitoring while reducing administrative workload. The LMS will enable
automated grading, role-based access control, and secure data management. Organizations can
leverage data-driven insights to improve learning outcomes and optimize training programs.

CONCLUSION:
The problem statement was written successfully by following the steps described above.
6
7
Expt.No:2
Date: SOFTWARE REQUIREMENTS SPECIFICATION (SRS)

AIM:

To develop a Software Requirements Specification (SRS) document that defines the


functional and non-functional requirements of a Learning Management System (LMS) to
ensure effective course management, learner engagement, and performance tracking.

THEORY:
This SRS outline serves as a skeleton for preparing the Software Requirements Specification
document. It includes all the necessary sections to clearly define the Student Information System
(SIS)'s functionality, performance expectations, user needs, and technical requirements.
1. Introduction: Explains the purpose and structure of the document.
2. System Description: High-level overview of the system and its stakeholders.
3. Functional Requirements: Detailed description of the system’s functionality.
4. Non-Functional Requirements: Describes system qualities like performance, security,
and scalability.
5. System Features: Breaks down the system’s features into functional modules.
6. External Interface Requirements: Defines interfaces for users, hardware, and software.
7. System Design Constraints: Lists any design constraints (technology stack, platforms).
8. Acceptance Criteria: Lists conditions to determine whether the system meets
the requirements.
9. Glossary of Terms: Provides definitions for technical terms used in the document.
10. Appendices: Includes any extra information or references.

FORMAT OF SRS DOCUMENT:


1. Introduction
● 1.1 Purpose
A brief description of the purpose of the SRS document and the system being described
(e.g., Student Information System).
● 1.2 Scope
Defines the boundaries of the system, describing what it will and won’t do.
● 1.3 Definitions, Acronyms, and Abbreviations
List any technical terms, acronyms, or abbreviations used in the document (e.g., GPA,
SIS).
● 1.4 References
Any external documents or standards referenced in the SRS (e.g., university
regulations, data security standards).
● 1.5 Overview
A brief overview of the structure of the SRS document.
2. System Description
● 2.1 System Overview
High-level description of the system, its purpose, and the features it will provide.

8
● 2.2 User Needs and Stakeholders
Identification of primary users and their needs (e.g., students, faculty, administrators).
● 2.3 Assumptions and Dependencies
List any assumptions made during the system’s development and dependencies on
external systems or hardware.
3. Functional Requirements
● 3.1 Functional Requirements for Students
Description of functionalities that students will interact with (e.g., registration, grade
viewing).
● 3.2 Functional Requirements for Faculty
Description of functionalities for faculty (e.g., grade entry, student performance
tracking).
● 3.3 Functional Requirements for Administrators
Description of functionalities for administrators (e.g., managing student records, user
management).
● 3.4 Use Cases and User Stories
Include key use cases (e.g., "Student logs in to view grades") and user stories for better
understanding.
4. Non-Functional Requirements
● 4.1 Performance
Expected system performance criteria (e.g., response time, load capacity).
● 4.2 Security
Security requirements (e.g., user authentication, data encryption).
● 4.3 Usability
User interface requirements (e.g., easy-to-navigate dashboard, mobile-friendly design).
● 4.4 Reliability and Availability
Expected system uptime and reliability (e.g., 99% uptime).
● 4.5 Scalability
Ability to handle increased usage or future expansion.
5. System Features
● 5.1 Feature 1: Student Registration
Detailed description of the student registration process, including inputs, processes, and
outputs.
● 5.2 Feature 2: Grade Management
Description of grade entry and viewing for faculty and students.
● 5.3 Feature 3: Attendance Tracking
Description of the attendance tracking functionality.
● 5.4 Feature 4: Report Generation
Describe the generation of various reports (e.g., student performance, attendance).
6. External Interface Requirements
● 6.1 User Interfaces
Description of the user interface for students, faculty, and administrators (e.g., web
interface).
● 6.2 Hardware Interfaces
Any required hardware components (e.g., printers, servers).

9
● 6.3 Software Interfaces
Interaction with external software (e.g., third-party authentication systems).
● 6.4 Communication Interfaces
Any required network protocols or APIs for data exchange.
7. System Design Constraints
● 7.1 Technology Stack
Define the technology stack used for development (e.g., Java, MySQL).
● 7.2 Platform Constraints
Describe platform-specific constraints (e.g., web-based, supports Windows and Linux).
● 7.3 Operational Constraints
Any operational limitations (e.g., must run on a university server).
8. Acceptance Criteria
● 8.1 Functional Testing Criteria
Criteria to test the main features (e.g., students can register, faculty can enter grades).
● 8.2 Performance Testing Criteria
Criteria for testing system performance (e.g., response time under load).
● 8.3 Security Testing Criteria
Testing criteria for security features (e.g., successful login with encrypted password).
9. Glossary of Terms
● 9.1 Definitions
Definitions of technical terms used in the document (e.g., GPA, student records).
● 9.2 Abbreviations
List of abbreviations (e.g., API, UI, GPA).
10. Appendices
● 10.1 Additional Information
Any additional relevant details (e.g., database schema, sample reports).
● 10.2 References
External references, documents, and standards.

CONCLUSION:

The Software Requirements Specification (SRS) was successfully developed, clearly defining the
system’s requirements for a well-structured design.

10
Expt.No:3
Date: USE CASE MODEL DIAGRAM

AIM:
To design a Use Case Model Diagram that visually define user roles, and illustrate the flow
of use cases to ensure a clear understanding of the system’s behavior and requirements.

THEORY:
A Use Case Model visually represents the interactions between the system and its users,
focusing on what the system should do (from the user's perspective).

SAMPLE USE CASE DIAGRAM:


Actors in the SIS:
1. Student
o A student who interacts with the system to manage personal details, check
grades, view attendance, etc.
2. Faculty (Instructor)
o A faculty member who manages student grades, attendance, and course-
related data.
3. Administrator
o The system administrator who manages user access, student records, courses,
and overall system configuration.
Use Cases for the SIS:
1. Student Use Cases
1. Register for Courses
o Description: A student registers for courses for the upcoming semester.
o Actor: Student
o Pre-condition: The student is logged in and has access to the list of
available courses.
o Post-condition: The courses are successfully registered for the student.
2. View Grades
o Description: A student views their grades for completed courses.
o Actor: Student
o Pre-condition: The student has completed courses with grades assigned.
o Post-condition: Grades for courses are displayed to the student.
3. View Attendance
o Description: A student views their attendance record for the semester.
o Actor: Student
o Pre-condition: The student is enrolled in courses, and attendance records
are being tracked.

11
o Post-condition: Attendance information is displayed to the student.
4. Update Personal Information
o Description: A student can update their contact details and other
personal information.
o Actor: Student
o Pre-condition: The student is logged into the system.
o Post-condition: The student's personal information is successfully updated.
2. Faculty Use Cases
1. Enter Grades
o Description: A faculty member enters grades for students in a particular course.
o Actor: Faculty
o Pre-condition: The faculty member is logged in and has access to the student
list for the course.
o Post-condition: The grades are successfully entered for each student.
2. View Student Attendance
o Description: A faculty member views the attendance records for students in
their course.
o Actor: Faculty
o Pre-condition: The faculty member is logged in and has access to the student
list for the course.
o Post-condition: Attendance records are displayed.
3. Create/Modify Course Information
o Description: A faculty member creates or modifies the course information,
such as syllabus, schedule, etc.
o Actor: Faculty
o Pre-condition: The faculty member has appropriate privileges to create or
modify the course.
o Post-condition: Course information is updated.
3. Administrator Use Cases
1. Add/Remove Students
o Description: The administrator can add or remove students from the system.
o Actor: Administrator
o Pre-condition: The administrator is logged in.
o Post-condition: The student records are updated (added or removed).
2. Create/Modify User Accounts
o Description: The administrator creates or modifies user accounts for students
and faculty.
o Actor: Administrator
o Pre-condition: The administrator has access to the system user
management feature.

12
o Post-condition: The user account is successfully created or modified.
3. View System Reports
o Description: The administrator views system usage and operational reports.
o Actor: Administrator
o Pre-condition: The administrator is logged into the system.
o Post-condition: Reports are displayed, showing various system metrics.
4. Manage Courses
o Description: The administrator adds, updates, or removes courses from
the system.
o Actor: Administrator
o Pre-condition: The administrator is logged into the system and has access
to course management features.
o Post-condition: The courses are successfully managed (added/updated/removed).
OUTPUT:

CONCLUSION:

The Use Case Diagram for the Learning Management System (LMS) was effectively
created, mapping interactions between users and the system to capture key functionalities.
Expt.No:4
Date: CLASS DIAGRAM

AIM:
To design a Class Diagram that represents the static structure of a software system by defining
its classes, attributes, methods, and relationships.

THEORY:
Step 1: Identify Conceptual Classes
Conceptual classes are key objects that are needed to describe the system and its functionality.
For a Student Information System, the conceptual classes could be:
1. Student
o Attributes: Student ID, First Name, Last Name, Date of Birth, Email, Address
o Responsibilities: Maintain personal information, register for courses,
view academic history.
2. Course
o Attributes: Course ID, Name, Description, Credits, Instructor, Schedule
o Responsibilities: Manage course details, assign instructors, define schedule.
3. Instructor
o Attributes: Instructor ID, First Name, Last Name, Email, Department
o Responsibilities: Teach courses, grade students, set course schedule.
4. Enrollment
o Attributes: Enrollment ID, Student, Course, Enrollment Date, Grade
o Responsibilities: Track course enrollment for a student, record grades.
5. Department
o Attributes: Department ID, Name, Location, Faculty List
o Responsibilities: Manage department details, assign instructors to courses.
6. Course Schedule
o Attributes: Schedule ID, Day, Time, Course, Instructor
o Responsibilities: Define when and where a course is taught.
7. Grade
o Attributes: Grade ID, Grade Value, Date, Enrollment
o Responsibilities: Store student grade for a course.
8. Transcript
o Attributes: Transcript ID, Student, List of Courses, List of Grades, GPA
o Responsibilities: Maintain a student’s academic record.

Step 2: Develop the Domain Model

A Domain Model represents the objects, their attributes, and relationships in the system.
Below is a simple description of the domain model:
● Student is linked to Enrollment because students enroll in courses.
● Enrollment is associated with Course and has a relationship to Grade.
● Course is associated with Instructor, indicating who teaches the course.
● Department oversees Instructor and is responsible for managing faculty.
● CourseSchedule links to Course and Instructor, detailing when and where the
course occurs.
● Transcript is associated with Student and holds the student’s academic record.

Step 3: Derive a Class Diagram


Here’s a basic description of how to draw the class diagram for the system:
● Student has a 1-to-many relationship with Enrollment (a student can have
many enrollments).
● Enrollment has a many-to-1 relationship with Course (each enrollment corresponds to
a single course).
● Enrollment has a 1-to-1 relationship with Grade (an enrollment has one grade).
● Course has a 1-to-many relationship with CourseSchedule (a course may have
multiple schedules).
● Instructor has a 1-to-many relationship with Course (an instructor can teach
multiple courses).
● Department has a 1-to-many relationship with Instructor (a department can
have multiple instructors).
● Student has a 1-to-1 relationship with Transcript.
DIAGRAM:

CONCLUSION:

The Class Diagram for the Learning Management System (LMS) was successfully
designed, representing the system’s structure, relationships, and object-oriented architecture.
Expt.No:5
Date: SEQUENCE AND COLLABORATION DIAGRAM
AIM:
To design Sequence and Collaboration Diagrams that depict the dynamic interactions
between objects in a software system. The objective is to illustrate the flow of messages over
time in a Sequence Diagram and the structural organization of objects communicating in a
Collaboration Diagram, ensuring a clear understanding of system behavior and interactions.

THOERY:
1. Sequence Diagram
A Sequence Diagram is a type of UML (Unified Modeling Language) diagram that models the
interactions between objects in a system in a sequential order. It emphasizes the time aspect of
the interactions by showing how objects communicate with each other in a step-by-step
manner. Each object is represented by a vertical line (lifeline), and the horizontal arrows
represent messages sent between objects.
Key Elements of a Sequence Diagram:
● Objects/Actors: Represented by vertical lines (lifelines).
● Messages: Represented by horizontal arrows showing the interaction between objects.
● Activation Bars: Represent when an object is active or performing an action.
● Return Messages: Represent responses or results sent back from one object to another.
Purpose: Sequence diagrams are used to visualize and understand how operations and
processes occur within a system, especially how the objects interact over time.
Sequence Diagram: "Student Enrolling in a Course"
In the Sequence Diagram for the scenario of a student enrolling in a course, we focus on the
interaction between the student, the system, and other objects involved in the enrollment
process. Actors and Objects:
● Student: The entity that initiates the enrollment request.
● Course: Represents the courses available in the system.
● CourseSchedule: Represents the schedule for each course.
● Enrollment: Represents the record of the student's enrollment in the course.
● Instructor: Represents the course instructor.
Steps:
1. The Student requests to enroll in a course (initiating the interaction).
2. The Student selects the course they wish to enroll in from the available courses.
3. The System (via the CourseSchedule) checks if the selected course has an available
schedule.
4. Once the course is available, the Enrollment object is created, linking the Student to
the selected Course.
5. The Enrollment is stored in the system, and the Student receives a confirmation
message. The sequence diagram shows how objects interact with each other in a timeline,
indicating the order of actions and responses between the student, the course system, and
other components involved.
2. Collaboration Diagram
A Collaboration Diagram (also called a Communication Diagram) is another type of UML
diagram that shows how objects collaborate with each other to achieve a specific task. Unlike
the Sequence Diagram, which emphasizes the time order of interactions, the Collaboration
Diagram emphasizes the structural aspect and the messages exchanged between objects. It
shows the relationships between objects as well as the flow of messages in a system.
Key Elements of a Collaboration Diagram:
● Objects: Represented by named rectangles.
● Messages: Represented by arrows between objects, labeled with the message name
and number to represent the sequence of communication.
● Links: Represent associations between objects in the system.
Purpose: Collaboration diagrams help illustrate the flow of messages between objects and how
they cooperate to perform a task, focusing more on the structure and interactions rather than
the timing of the events.
Collaboration Diagram: "Student Viewing Their Transcript"
In the Collaboration Diagram for the scenario of a student viewing their transcript, the focus is on
how objects work together to retrieve and display the student's academic record.
Actors and Objects:
● Student: The entity that requests the transcript.
● Transcript: Represents the student's academic record, showing all enrolled courses and
grades.
● Enrollment: Represents the courses the student has enrolled in.
● Course: Represents the individual courses the student has taken.
● Grade: Represents the grades earned by the student in each
course. Steps:
1. The Student requests their Transcript (initiating the process).
2. The Transcript object retrieves the list of courses the Student has taken by interacting
with the Enrollment object.
3. For each Enrollment, the System retrieves the corresponding Grade for that course.
4. The Transcript compiles the courses and grades and displays the complete academic
record to the Student.
DIAGRAM:
SEQUENCE DIAGRAM:
COLLABORATION DIAGRAM:

CONCLUSION:

The Sequence Diagram and Collaboration Diagram for the Learning Management System
(LMS) were successfully designed, accurately depicting the flow of interactions and object
collaborations within the system.
Expt.No:6
Date: STATE CHART AND ACTIVITY DIAGRAM

AIM:
To design State Chart and Activity Diagrams that illustrates the various states an object
undergoes and the transitions triggered by specific events, and models the flow of control and
execution of processes within the system.

THEORY:
1. State Chart Diagram the "Student Enrolling in a Course" Process
A State chart diagram is also called as state machine diagram. The state chart contains the states
in the rectangular boxes and the states are indicated by the dot enclosed. The state chart diagram
describes the behavior of the system. The state chart involves six stages such as login, enter
mark, enter profile, view details, provide details, update details, store details and logout.
States of the Student Object:
1. Inactive: This is the default state when a student has not logged into the system or performed
any actions yet.
2. Logged In: The student logs into the SIS, activating their account.
3. Browsing Courses: The student browses available courses in the system.
4. Enrolled in Courses: The student has successfully enrolled in one or more courses.
5. Viewing Transcript: The student requests and views their academic transcript.
6. Graduated: The student completes their program of study and graduates.
7. Suspended: If there are any issues with the student's status (e.g., academic misconduct,
unpaid fees), their account may be suspended.
2 Activity Diagram for the "Student Enrolling in a Course" Process
An Activity Diagram is used to represent the flow of activities in a process, showing how actions are
performed and how control flows between them. It is ideal for modeling workflows in a system.
Scenario: Student Enrolling in a Course
The Activity Diagram for Student Enrolling in a Course represents the flow of actions involved in the
enrollment process.
Steps in the Enrollment Process:
1. Student Logs in: The student enters their credentials to access the system.
2. Student Browses Available Courses: After logging in, the student selects the course they wish
to enroll in.
3. System Checks Course Availability: The system checks if the course is available (based on
the schedule and capacity).
4. Student Selects Course: The student selects the course if it is available.
5. System Creates Enrollment Record: The system creates an enrollment record linking the
student to the selected course.
6. Confirmation Sent to Student: Once enrolled, the system sends a confirmation message to
the student.
7. Student Logs Out: After completing the enrollment, the student logs out of the system
DIAGRAM:
STATE CHART DIAGRAM
ACTIVITY DIAGRAM

CONCLUSION:

The State Chart Diagram and Activity Diagram for the Learning Management System
were successfully designed, representing the behavior and workflow of the course enrollment and
learning process.
Expt. No: 7
Date: IMPLEMENTATION OF THE SYSTEM
AIM:
The aim is to design an algorithm and develop a Learning Management System (LMS)
that efficiently manages interactions between students, instructors, and administrators. The
system should streamline processes such as course creation, content delivery, student
enrollment, progress tracking, assessments, feedback collection, and certification, ensuring an
organized and effective learning experience.

ALGORITHM:
Step 1: User Registration & Authentication

Input: User details (name, email, password, role : student/instructor/admin)


Algorithm:

1. Accept user details.


2. Validate inputs (email format, password strength, uniqueness).
3. Encrypt password and store in the database.
4. Send email confirmation (if required).
5. User logs in with email & password.
6. Verify credentials and generate session token.
7. Redirect user based on role (student, instructor, admin).

Step 2: Course Creation (Instructor Side)

Input: Course details (title, description, syllabus, prerequisites, duration, materials, etc.)
Algorithm:

1. Instructor fills in course details.


2. Validate course details.
3. Store course information in the database.
4. Notify enrolled students (if applicable).
5. Display course listing on the platform.

Step 3: Course Enrollment (Student Side)

Input: Search criteria (course title, category, instructor, difficulty level, etc.)
Algorithm:

1. Student enters search parameters.


2. Query database for matching courses.
3. Display available courses.
4. Student selects a course and enrolls.
5. Store enrollment details.
6. Notify the instructor about new enrollment.

Step 4: Content Delivery & Learning Progress Tracking

Input: Course materials (videos, PDFs, quizzes, assignments, etc.)


Algorithm:

1. Instructor uploads course materials.


2. Validate and store content in the system.
3. Students access materials based on course progress.
4. Track student engagement and completion status.
5. Provide progress reports to students and instructors.

Step 5: Assessments & Evaluation

Input: Assignments, quizzes, exams submitted by students


Algorithm:

1. Students submit assessments.


2. Validate and store submissions.
3. Auto-grade (if applicable) or notify instructor for manual grading.
4. Instructor reviews and provides feedback.
5. Store grades and update student progress.
6. Notify students about results.

Step 6: Moderation & Content Management (Admin Side)

Input: Course materials, student interactions, reports


Algorithm:

1. Admin reviews courses and materials for quality.


2. Moderate discussions, comments, and reports.
3. Filter out inappropriate content based on predefined guidelines.
4. Notify instructors about necessary modifications.
5. Take action on reported issues.

Step 7: Certification & Course Completion

Input: Student performance data & course completion status


Algorithm:

1. Evaluate student performance and completion criteria.


2. Generate digital certificates (if applicable).
3. Notify students about certification.
4. Store certification details in the student profile.

Step 8: User Dashboard & Notifications

Input: User interactions (course updates, assignments, discussions, messages, etc.)


Algorithm:

1. Display personalized dashboard for students, instructors, and admins.


2. Provide real-time notifications (new courses, deadlines, grades, messages, etc.).
3. Allow users to manage profiles, enrolled courses, and materials.

PROGRAM:

JobPortalApplication.java

package com.lms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class LearningManagementSystemApplication {
public static void main(String[] args) {
SpringApplication.run(LearningManagementSystemApplication.class, args);
}
}

MvcConfig.java

package com.lms.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.nio.file.Path;
import java.nio.file.Paths;

@Configuration
public class MvcConfig implements WebMvcConfigurer {
private static final String UPLOAD_DIR = "course-materials";

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
exposeDirectory(UPLOAD_DIR, registry);
}

private void exposeDirectory(String uploadDir, ResourceHandlerRegistry registry) {


Path path = Paths.get(uploadDir);
registry.addResourceHandler("/" + uploadDir + "/**").addResourceLocations("file:" +
path.toAbsolutePath() + "/");
}
}
CustomAuthenticationSuccessHandler.java
package com.lms.config;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
import java.io.IOException;

@Component
public class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler
{ @Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse
response, Authentication authentication) throws IOException {
UserDetails userDetails = (UserDetails) authentication.getPrincipal();
String userName = userDetails.getUsername();
System.out.println("The user " + userName + " is logged in");

boolean isStudent = authentication.getAuthorities().stream().anyMatch(r ->


r.getAuthority().equals("Student"));
boolean isInstructor = authentication.getAuthorities().stream().anyMatch(r ->
r.getAuthority().equals("Instructor"));

if (isStudent) {
response.sendRedirect("/student-dashboard/");
} else if (isInstructor) {
response.sendRedirect("/instructor-dashboard/");
} else {
response.sendRedirect("/login?error");
}
}
}

Users.java

package com.lms.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotEmpty;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;

@Entity
@Table(name = "users")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Users
{ @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int userId;

@Column(unique = true)
private String email;

@NotEmpty
private String password;

private boolean

isActive;

@DateTimeFormat(pattern = "dd-MM-yyyy")
private Date registrationDate;

@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "roleId", referencedColumnName = "roleId")
private UserRole role;
}

// Courses Entity
package com.lms.entity;
import jakarta.persistence.*;
import lombok.*;
import java.util.List;

@Entity
@Table(name = "courses")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Course {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int courseId;
private String title;
private String
description; private
String instructor;

@OneToMany(mappedBy = "course")
private List<Enrollment> enrollments;
}

// Enrollment Entity
package com.lms.entity;
import jakarta.persistence.*;
import lombok.*;

@Entity
@Table(name = "enrollments")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Enrollment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int enrollmentId;

@ManyToOne
@JoinColumn(name = "userId", referencedColumnName = "userId")
private Users student;

@ManyToOne
@JoinColumn(name = "courseId", referencedColumnName = "courseId")
private Course course;
}

Course Entity for Learning Management System (LMS)

package com.lms.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Entity
public class Course {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer courseId;
private String title;
private String
description; private
String thumbnail;
}

User Repository

package com.lms.repository;

import com.lms.entity.Users;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;

public interface UsersRepository extends JpaRepository<Users, Integer>


{ Optional<Users> findByEmail(String email);
}

CourseActivityController

package com.lms.controllers;

import com.lms.entity.CourseActivity;
import com.lms.entity.InstructorCoursesDto;
import com.lms.entity.InstructorProfile;
import com.lms.entity.Users;
import com.lms.services.CourseActivityService;
import com.lms.services.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import
org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.PostMapping;

import java.util.Date;
import java.util.List;
@Controller
public class CourseActivityController {
private final UsersService usersService;
private final CourseActivityService courseActivityService;

@Autowired
public CourseActivityController(UsersService usersService, CourseActivityService
courseActivityService) {
this.usersService = usersService;
this.courseActivityService = courseActivityService;
}

@GetMapping("/dashboard/")
public String viewCourses(Model model) {
Object currentUserProfile = usersService.getCurrentUserProfile();
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

if (!(authentication instanceof AnonymousAuthenticationToken)) {


String currentUsername = authentication.getName();
model.addAttribute("username", currentUsername);

if (authentication.getAuthorities().contains(new SimpleGrantedAuthority("Instructor")))
{
List<InstructorCoursesDto> instructorCourses =
courseActivityService.getInstructorCourses(((InstructorProfile)
currentUserProfile).getUserAccountId());
model.addAttribute("courses", instructorCourses);
}
}
model.addAttribute("user", currentUserProfile);
return "dashboard";
}

@GetMapping("/dashboard/add")
public String addCourse(Model model)
{ model.addAttribute("courseActivity", new CourseActivity());
model.addAttribute("user", usersService.getCurrentUserProfile());
return "add-course";
}

@PostMapping("/dashboard/addNew")
public String addNew(CourseActivity courseActivity, Model model) {
Users user = usersService.getCurrentUser();
if (user != null) {
courseActivity.setCreatedBy(user);
}
courseActivity.setCreatedDate(new Date());
model.addAttribute("courseActivity", courseActivity);
courseActivityService.addNew(courseActivity);
return "redirect:/dashboard/";
}

@GetMapping("/dashboard/edit/{id}")
public String editCourse(@PathVariable("id") int id, Model model) {
CourseActivity courseActivity = courseActivityService.getOne(id);
model.addAttribute("courseActivity", courseActivity);
model.addAttribute("user", usersService.getCurrentUserProfile());
return "add-course";
}
}

Index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LMS - Home</title>
<link th:rel="stylesheet" th:href="@{/webjars/bootstrap/css/bootstrap.min.css}"/>
<link rel="stylesheet" type="text/css" media="all" th:href="@{/css/fontawesome.min.css}"/>
<link rel="stylesheet" type="text/css" media="all" th:href="@{/css/styles.css}"/>
<meta charset="ISO-8859-1">
</head>
<body class="background">

<!-- Navigation Bar -->


<nav class="main_div">
<div class="logo_left">
<label class="logo">
EduLearn
</label>
<label class="logo_com">
.com
</label>
</div>
<div class="logo_right">
<label class="Student_login_btn">
<a th:href="@{/login}">
Student Login
</a>
<a th:href="@{/register}">
| Register
</a>
</label>
<label class="Instructor_login_btn">
<a th:href="@{/login}">
Instructor Login
</a>
<a th:href="@{/register}">
| Register
</a>
</label>
</div>
</nav>

<!-- Course Search -->


<form th:action="@{/course-search/}">
<div class="searchBox">
<div class="inner">
<input type="text" placeholder="Search for a course" name="course"
th:value="${course}"/>
<input type="text" placeholder="Enter a category" name="category"
th:value="${category}"/>
<button type="submit"><i class="fa fa-search"></i></button>
</div>
</div>
</form>

<!-- Featured Courses Section -->


<div class="container mt-5">
<h2 class="text-center">Popular Courses</h2>
<div class="row">
<div class="col-md-4" th:each="course : ${courses}">
<div class="card">
<img th:src="${course.image}" class="card-img-top" alt="Course Image">
<div class="card-body">
<h5 class="card-title" th:text="${course.name}"></h5>
<p class="card-text" th:text="${course.description}"></p>
<a th:href="@{/course-details/{id}(id=${course.id})}" class="btn btn-
primary">Enroll Now</a>
</div>
</div>
</div>
</div>
</div>

<!-- Footer -->


<footer>
<label class="copy-right">Copyright © LMS EduLearn</label>
</footer>

<script type="text/javascript" th:src="@{/webjars/jquery/jquery.min.js}"></script>


<script type="text/javascript" th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
</body>
</html>

Dashboard.html

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Job Portal Dashboard</title>
<link rel="stylesheet" th:href="@{/webjars/bootstrap/css/bootstrap.min.css}"/>
<script th:src="@{/webjars/jquery/jquery.min.js}"></script>
<script th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
</head>
<body>
<header class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand ms-3" href="#">Job Portal</a>
<div class="collapse navbar-collapse">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" th:href="@{/jobs}">Jobs</a></li>
<li class="nav-item"><a class="nav-link" th:href="@{/profile}">Profile</a></li>
<li class="nav-item"><a class="nav-link text-danger"
th:href="@{/logout}">Logout</a></li>
</ul>
</div>
</header>

<div class="container mt-4">


<h2 class="text-center">Welcome, <span th:text="${user.name}"></span></h2>
<div class="row">
<div class="col-md-8">
<h4>Available Jobs</h4>
<ul class="list-group">
<li class="list-group-item" th:each="job : ${jobs}">
<strong th:text="${job.title}"></strong> - <span
th:text="${job.company}"></span>
<a class="btn btn-primary btn-sm float-end"
th:href="@{/jobs/{id}(id=${job.id})}">Apply</a>
</li>
</ul>
</div>
<div class="col-md-4">
<h4>Your Profile</h4>
<div class="card">
<div class="card-body">
<p><strong>Email:</strong> <span th:text="${user.email}"></span></p>
<a class="btn btn-warning" th:href="@{/profile/edit}">Edit Profile</a>
</div>
</div>
</div>
</div>
</div>

<footer class="bg-dark text-white text-center p-3 mt-4">


<p>© 2025 Job Portal</p>
</footer>
</body>
</html>

Course Details

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Course Details</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Available Courses</h1>
<div class="courses">
<div class="course">
<h2 class="course-title">Flutter for Beginners</h2>
<h3 class="instructor-name">Instructor: John Doe</h3>
<p class="course-description">
Learn Flutter from scratch with real-world projects. Covers UI design, state management, and
Firebase integration.
</p>
<button class="enroll-btn">Enroll Now</button>
<p class="success-message hidden">✅Enrolled Successfully!</p>
</div>

<div class="course">
<h2 class="course-title">Web Development with React</h2>
<h3 class="instructor-name">Instructor: Jane Smith</h3>
<p class="course-description">
Learn React.js from basics to advanced concepts, including hooks, Redux, and API
integration.
</p>
<button class="enroll-btn">Enroll Now</button>
<p class="success-message hidden">✅Enrolled Successfully!</p>
</div>

<div class="course">
<h2 class="course-title">Python for Data Science</h2>
<h3 class="instructor-name">Instructor: Mark Wilson</h3>
<p class="course-description">
Master Python for data analysis, visualization, and machine learning with hands-on projects.
</p>
<button class="enroll-btn">Enroll Now</button>
<p class="success-message hidden">✅Enrolled Successfully!</p>
</div>
</div>
</div>

<script src="script.js"></script>
</body>
</html>

LMS Database Schema

DROP DATABASE IF EXISTS `lms`;


CREATE DATABASE `lms`;
USE `lms`;

-- User types (Admin, Instructor, Student)


CREATE TABLE `user_type` (
`user_type_id` INT NOT NULL AUTO_INCREMENT,
`user_type_name` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`user_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `user_type` VALUES (1, 'Admin'), (2, 'Instructor'), (3, 'Student');

-- Users Table
CREATE TABLE `users` (
`user_id` INT NOT NULL AUTO_INCREMENT,
`email` VARCHAR(255) UNIQUE,
`password` VARCHAR(255) NOT NULL,
`full_name` VARCHAR(255) NOT NULL,
`is_active` BIT(1) DEFAULT 1,
`registration_date` DATETIME DEFAULT CURRENT_TIMESTAMP,
`user_type_id` INT,
PRIMARY KEY
(`user_id`),
FOREIGN KEY (`user_type_id`) REFERENCES `user_type` (`user_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Courses Table
CREATE TABLE `courses` (
`course_id` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`description` TEXT,
`instructor_id` INT,
`created_date` DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`course_id`),
FOREIGN KEY (`instructor_id`) REFERENCES `users` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Enrollments Table
CREATE TABLE `enrollments` (
`id` INT NOT NULL AUTO_INCREMENT,
`student_id` INT,
`course_id` INT,
`enrollment_date` DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY (`student_id`, `course_id`),
FOREIGN KEY (`student_id`) REFERENCES `users` (`user_id`),
FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Lessons Table
CREATE TABLE `lessons` (
`lesson_id` INT NOT NULL AUTO_INCREMENT,
`course_id` INT,
`title` VARCHAR(255) NOT NULL,
`content` TEXT,
`video_url` VARCHAR(255) DEFAULT NULL,
`created_date` DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`lesson_id`),
FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Assignments Table
CREATE TABLE `assignments` (
`assignment_id` INT NOT NULL AUTO_INCREMENT,
`course_id` INT,
`title` VARCHAR(255) NOT NULL,
`description` TEXT,
`due_date` DATETIME,
PRIMARY KEY (`assignment_id`),
FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Assignment Submissions Table
CREATE TABLE `submissions` (
`submission_id` INT NOT NULL AUTO_INCREMENT,
`assignment_id` INT,
`student_id` INT,
`file_url` VARCHAR(255),
`submitted_date` DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`submission_id`),
FOREIGN KEY (`assignment_id`) REFERENCES `assignments` (`assignment_id`),
FOREIGN KEY (`student_id`) REFERENCES `users` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CONCLUSION:
In this experiment, we designed an algorithm and implemented a program for a Learning Management
System (LMS) that efficiently manages interactions between students, instructors, and administrators.
The algorithm defines a structured workflow for key learning processes, while the program code
translates this logic into a functional system, ensuring seamless course management, student enrollment,
and progress tracking.
Expt. No: 8
Date: TESTING THE SOFTWARE SYSTEM

AIM:

The aim of this exercise is to design and execute testing scenarios for the Learning Management System
(LMS) to ensure efficient course management, student enrollment, progress tracking, and seamless
interaction between students, instructors, and administrators.

TESTING SCENARIOS:

Here’s your LMS testing scenarios in the same format as your image:

1. User Registration &

Authentication Successful

Registration
 Enter valid name, email, password, and role.
 Click "Register" button.
 Expected Result: Registration successful, user redirected to login.
 Status: Pass

Login with Incorrect Password


 Enter registered email and incorrect password.
 Click "Login" button.
 Expected Result: Error message: ‘Invalid Credentials’.
 Status: Pass

2. Course Management (Instructor


Side) Instructor Creates a Course
 Login as an instructor.
 Enter course details.
 Click "Create Course".
 Expected Result: Course appears in course list.
 Status: Pass

Course Creation with Missing Fields


 Leave required fields empty.
 Click "Create Course".
 Expected Result: Error message highlights missing fields.
 Status: Pass
3. Course Enrollment (Student
Side) Student Enrolls in a Course
 Login as a student.
 Browse available courses.
 Click "Enroll".
 Expected Result: Enrollment successful, course added to dashboard.
 Status: Pass

Enrollment with Full Capacity


 Attempt to enroll in a course that has reached full capacity.
 Expected Result: Error message: ‘Course is full’.
 Status: Pass

4. Content Delivery & Learning


Progress Accessing Course Materials
 Login as a student.
 Navigate to course.
 Open lesson/video.
 Expected Result: Content loads successfully.
 Status: Pass
Tracking Learning Progress
 Complete course sections.
 Check progress bar.
 Expected Result: Progress updates correctly.
 Status: Pass

5. Assessments &
Grading Taking an Exam
 Start a quiz/test.
 Submit answers.
 Expected Result: Results displayed after completion.
 Status: Pass
Automatic Grading
 Instructor creates quiz with MCQs.
 Student submits the quiz.
 Expected Result: System auto-grades correctly.
 Status: Pass

6. Discussion Forums &


Communication Posting in a Forum
 Login as a student.
 Navigate to discussion board.
 Post a question.
 Expected Result: Post appears in the forum.
 Status: Pass
Sending Messages
 Open chat window.
 Send a message to an instructor.
 Expected Result: Message delivered successfully.
 Status: Pass

7. Security & Data Protection


Password Encryption
Validation
 Check stored passwords in the database.
 Expected Result: Passwords are stored in encrypted form.
 Status: Pass
Role-Based Access Control
 Try accessing instructor features as a student.
 Expected Result: Access denied.
 Status: Pass

CONCLUSION
In this experiment, we tested the Learning Management System (LMS) to ensure its
functionality, security, and performance. The test cases validated key features like user
authentication, course management, and assessments. Security checks confirmed data protection
measures. Overall, the process improved system reliability and efficiency.
Expt. No: 9
Date: DESIGN PATTERN

AIM:
The aim is to design and implement the Model-View-Controller (MVC) pattern in a software
system.

MVC (MODEL-VIEW-CONTROLLER) PATTERN


The MVC pattern separates the system into three layers:
1. Model: Handles data and business logic.
2. View: Manages the GUI and presentation.
3. Controller: Connects the Model and View, handling user inputs and interactions.
The MVC design pattern is a common architectural pattern that divides a software application
into three interconnected components. This separation helps organize code, improves
maintainability, and enables independent development of each layer.
1. Model
The Model layer is responsible for:
● Managing data and business logic.
● Handling interactions with the database.
● Implementing methods to fetch, update, or delete data.
2. View
The View layer is responsible for:
● Displaying the user interface (UI).
● Presenting data to the user.
● Accepting inputs, such as button clicks, without handling business logic.
3. Controller
The Controller layer:
● Handles user inputs and interactions.
● Acts as a bridge between the Model and View.
● Processes user requests, interacts with the Model, and updates the View.
Benefits of MVC
1. Separation of Concerns:
o The Model handles the data logic independently of the View and Controller.
o The View is dedicated to UI/UX, while the Controller orchestrates the interaction.
2. Improved Maintainability:
o Changes in one component (e.g., database schema) do not directly affect others.
o It is easier to test individual layers.
3. Scalability:
o The system is modular and easy to extend (e.g., adding a new View like a web interface).
4. Reusability:
o You can reuse the Model or View components in other systems or applications.
ALGORITHM:

Model-View-Controller (MVC) Algorithm for Learning Management System (LMS) Step


1: Define the Model (Data Layer)
Input: Course-related data (course title, description, instructor), user details (students, instructors,
admins)
Process:
1. Create Model classes to represent entities such as Course, User, Enrollment.
2. Define attributes for each entity (e.g., Course.java with title, description, instructor).
3. Implement getter and setter methods to manage data.
4. Connect the Model with a database using JPA or Hibernate.

Step 2: Define the View (Presentation Layer)


Input: Data from the Model (course listings, user details, progress reports)
Process:
1. Create View components using HTML, JSP, or frontend frameworks.
2. Implement methods to retrieve course data from the Model.
3. Display course catalogs, user details, and progress tracking on the UI.
4. Capture user inputs such as course enrollments, quiz submissions, and feedback.

Step 3: Define the Controller (Logic & Interaction Layer)


Input: User actions (course enrollment, content access, quiz submission)
Process:
1. Create Controller classes (CourseController.java, UserController.java).
2. Capture user inputs from the View (e.g., enrollments, quiz submissions).
3. Validate and process inputs.
4. Interact with the Model to retrieve or update data.
5. Return processed data to the View for display.

PROGRAM:

Index.html

package com.educationportal.repository;

import com.educationportal.entity.ICourseDetails;
import com.educationportal.entity.Course;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CourseRepository extends JpaRepository<Course, Integer> {


@Query(value = "SELECT c.course_id, c.course_name, c.description, c.duration, i.id as instructorId,
i.name as instructorName " +
"FROM course c " +
"INNER JOIN instructor i "
+ "ON c.instructor_id = i.id
"+
"WHERE c.created_by = :instructor " +
"GROUP BY c.course_id", nativeQuery =
true)
List<ICourseDetails> getCoursesByInstructor(@Param("instructor") int instructor);
}

Course.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Education Portal - Courses</title>
<link th:rel="stylesheet" th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" />
<link rel="stylesheet" type="text/css" media="all" th:href="@{/css/styles.css}" />
</head>
<body class="background">

<nav class="main_div">
<div class="logo_left">
<label class="logo">EduCourses</label>
<label class="logo_com">.com</label>
</div>
<div class="logo_right">
<label class="Student_login_btn">
<a th:href="@{/login}">User Login</a>
<a th:href="@{/register}">| Register</a>
</label>
<label class="Instructor_login_btn">
<a th:href="@{/login}">Instructor Login</a>
<a th:href="@{/register}">| Register</a>
</label>
</div>
</nav>

<form th:action="@{/course-search/}">
<div class="searchBox">
<div class="inner">
<input type="text" placeholder="Search for a course" name="course" th:value="${course}" />
<input type="text" placeholder="Enter instructor name" name="instructor" th:value="$
{instructor}" />
<button type="submit"><i class="fa fa-search"></i></button>
</div>
</div>
</form>

<footer>
<label class="copy-right">Copyright © Your Name</label>
</footer>

<script type="text/javascript" th:src="@{/webjars/jquery/jquery.min.js}"></script>


<script type="text/javascript" th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
</body>
</html>

CourseController.java

package com.educationportal.controllers;

import com.educationportal.entity.Course;
import com.educationportal.services.CourseService;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import
org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.PostMapping;
import org.springframework.validation.BindingResult;

import java.util.List;

@Controller
public class CourseController {
private final CourseService courseService;

@Autowired
public CourseController(CourseService courseService) {
this.courseService = courseService;
}

@PostMapping("/course/create")
public String createCourse(@Valid Course course, BindingResult result, Model model) {
courseService.addNew(course);
return "redirect:/dashboard/";
}

@GetMapping("/login")
public String login() {
return "login";
}

@GetMapping("/logout")
public String logout(HttpServletRequest request, HttpServletResponse response) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
new SecurityContextLogoutHandler().logout(request, response, authentication);
}
return "redirect:/";
}
}

OUTPUT:

CONCLUSION:

In this experiment, we implemented the Model-View-Controller (MVC) pattern in the


Learning Management System (LMS), ensuring a clear separation of concerns. The Model
handles data and business logic, the View manages user interface presentation, and the
Controller processes user inputs and updates the View accordingly.

You might also like