Software Engineering Lab Manual
Software Engineering Lab Manual
Semester
Roll. No.
Batch
Submitted To
List of Experiments
Experiment Experiment Name Page
No. Number
1 Prepare a Software Requirement Specification (SRS) document in 04
line with the IEEE recommended standards for Airline
Reservation System.
2 Prepare a software requirement specification (SRS) for passport 09
automation system or Digi yatra system.
3 Draw the Entity relationship diagram for any school at Galgotias 13
University's
4 Draw the data flow diagrams at level 0 and level 1 for GU 18
Examination Board.
5 Design the Use case diagram, Class Diagram, Activity diagram, 21
Sequence diagram for ATM Operations.
6 Design the Use case diagram, Class Diagram, Activity diagram, 40
Sequence diagram for GU library Management System.
7 Design the Use case diagram, Class Diagram, Activity diagram, 49
Sequence diagram, Component diagram, Deployment Model for
GU - SCSE.
8 To develop a Railway Reservation System that allows users to 56
book, cancel, and manage train reservations, enabling efficient
and user-friendly railway service management.
9 To develop an Expert System for prescribing medicines based on 67
given symptoms, enabling Remote Diagnostics and
Patient/Hospital Management.
10 To develop a test case for unit testing by using JUnit Tool. 78
11 To develop a test case for Integration testing by using JUnit Tool. 82
12 Design and develop a program in a Java language to solve the 87
triangle problem defined as follows. Accept three integers which
are supposed to be the three sides of a triangle and determine the
three values represent an equilateral triangle, isosceles triangle,
and scalene triangle or they do not form a triangle at all. Assume
that the upper limit for the size of any side is 10. Derive test cases
for your program based on boundary value analysis, and execute
the test cases and discuss the results.
2
Experiment: 1
Prepare a Software Requirement Specification (SRS) document in line with the IEEE
recommended standards for Airline Reservation System.
Procedure:
Software Requirements Specification (SRS) Document
1. Introduction
1.1 Purpose
The purpose of this Software Requirements Specification (SRS) document is to provide a
comprehensive description of the Airline Reservation System (ARS). This document will serve
as a guide for the development, validation, and maintenance of the ARS, ensuring all
stakeholders have a clear understanding of the system's requirements.
1.2 Scope
The Airline Reservation System is designed to manage flight reservations, ticketing, and
passenger information. It will support functionalities for booking flights, checking flight
availability, managing user accounts, and generating reports. The system will be used by airline
staff and passengers.
1.4 References
- IEEE Std 830-1998: IEEE Recommended Practice for Software Requirements Specifications
- Airline industry standards and guidelines
1.5 Overview
This document is organized into the following sections:
- Introduction
- Overall Description
3
- Specific Requirements
- Appendices
2. Overall Description
4
2.5 Design and Implementation Constraints
- Compliance with data protection regulations (e.g., GDPR)
- Integration with existing airline databases and payment systems
- Scalability to handle peak loads during high-demand periods
3. Specific Requirements
5
3.1.5 Reporting
- The system shall generate reports on bookings, cancellations, and revenue.
- Reports shall be available in various formats (e.g., PDF, CSV).
3.2.1 Performance
- The system shall support up to 10,000 concurrent users.
- Response time for flight search queries shall be under 3 seconds.
3.2.2 Security
- The system shall implement SSL encryption for data transmission.
- User data shall be stored securely with access control mechanisms in place.
3.2.3 Usability
- The system shall have an intuitive and user-friendly interface.
- The system shall provide help documentation and customer support features.
3.2.4 Reliability
- The system shall have an uptime of 99.9% and provide backup and recovery solutions.
3.2.5 Maintainability
- The system shall be designed for easy maintenance and updates.
- Code shall follow standard coding practices and be documented thoroughly.
6
3.3.3 Software Interfaces
- The system shall interface with external payment gateways and flight data services.
- The system shall use RESTful APIs for integration with other services.
4. Appendices
4.1 Glossary
- **Booking Confirmation**: An email or notification sent to users confirming their flight
reservation.
- **Seat Allocation**: The process of assigning a specific seat to a booked flight.
Result:
This SRS document provides a comprehensive outline of the Airline Reservation System's
requirements. Each section ensures that all stakeholders have a clear understanding of
the system's capabilities, constraints, and interfaces.
7
Experiment: 2
Prepare a Software Requirement Specification (SRS) document in line with the IEEE
recommended standards for Passport Automation System.
Procedure:
1.1 Objective
The purpose of this document is to specify the requirements for the Passport Automation
System (PAS). This system aims to streamline the process of passport application, renewal,
and management by automating manual tasks and improving efficiency.
1.2 Scope
The PAS will automate the following processes:
Application submission
Document verification
Payment processing
Status tracking
Printing and distribution of passports
1.4 References
ISO/IEC 27001: Information security management systems
National Passport Guidelines [Country-specific guidelines]
2. Overall Description
2.1 Product Perspective
The PAS will be a web-based application integrated with a backend database and document
management system. It will provide interfaces for applicants, administrative staff, and
government officials.
8
2.2 Product Functions
The system will support the following functions:
User registration and authentication
Passport application submission and tracking
Document upload and verification
Payment gateway integration
Passport issuance and printing
3. Specific Requirements
3.1 Functional Requirements
3.1.1 User Registration and Authentication
Users must be able to register with personal information and verify their identity.
The system should support password recovery and multi-factor authentication.
9
3.1.2 Passport Application Submission
Users can fill out and submit passport applications online.
The system should allow users to upload required documents in various formats.
3.1.3 Document Verification
Administrative staff should be able to review and verify uploaded documents.
Integration with third-party verification services for authenticity checks.
3.1.4 Payment Processing
Integration with a secure payment gateway for processing fees.
Users should receive confirmation of payment.
3.1.5 Status Tracking
Applicants should be able to track the status of their application in real-time.
Notifications via email or SMS for status updates.
3.1.6 Passport Issuance and Printing
System-generated passport documents must meet government standards.
Integration with printers for passport issuance.
10
4. External Interface Requirements
4.1 User Interfaces
Web-based user interface with responsive design.
Admin dashboard with tools for managing applications and user accounts.
4.2 Hardware Interfaces
Integration with passport printers.
Scanners for document verification.
4.3 Software Interfaces
APIs for payment gateway integration.
Integration with existing government databases.
4.4 Communications Interfaces
Support for email and SMS notifications.
Secure communication protocols for data exchange.
5. Other Requirements
5.1 Legal and Regulatory Requirements
Compliance with national and international passport regulations.
Adherence to data protection laws and standards.
5.2 Documentation
User manuals for applicants and administrative staff.
Technical documentation for system maintenance and upgrades
Result:
This SRS document provides a comprehensive outline of the passport automation system
requirements. Each section ensures that all stakeholders have a clear understanding of
the system's capabilities, constraints, and interfaces.
11
Experiment: 3
Prepare an entity relationship diagram for any school at Galgotias University.
Tools:
Microsoft Visio / LucidChart.
ER Model:
An Entity-Relationship Model represents the structure of the database with the help of
a diagram.
ER Modelling is a systematic process to design a database as it would require to analyze
all data requirements before implementing the database.
Lines: It links attributes to entity types and entity types with other relationship types
12
13
1. ER Diagram for Student Management System
14
2. ER Diagram for Examination Process
15
3. ER Diagram for University Management System
Result:
This diagram helps in understanding the structure and flow of data within the system,
supporting efficient database design and management for university operations.
16
Experiment 4:
Draw the data flow diagrams at level 0 and level 1 for GU Examination Board.
Tools:
Microsoft Visio
DFD
In Software engineering DFD (data flow diagram) can be drawn to represent the system
of different levels of abstraction.
It is a graphical representation of data flow in any system.
It is capable of illustrating incoming data flow, outgoing data flow and store data.
Data flow diagram describes anything about how data flows through the system.
1-Level provides a more detailed view of the system by breaking down the major
processes identified in the level 0 Data Flow Diagram (DFD) into sub-processes.
17
3- Level Data Flow Diagram (DFD)
3-Level is the most detailed level of Data Flow Diagram (DFDs), which provides a
detailed view of the processes, data flows, and data stores in the system.
Session management
Examination
management
system
Student management System user
management
Login management
18
Student management Generate Student
report
Examination
management
system
Branch management Generate branch
report
Result:
This diagram helps in understanding the DFD.
19
Experiment: 5
Design the Use case diagram, Class Diagram, Activity diagram, State Chart diagram,
Sequence diagram, Collaboration diagram, Deployment diagram and also generate the
code automatically by testing the test cases for ATM Operations by using the rational
rose enterprise edition software.
Software Required:
Rational Rose Enterprise Edition / MS Visio / Visual Paradigm
20
Customer
Client
Bank officer
Bank System
ATM Machine (Optional, can be treated as an actor or part of the system)
Identify the Use Cases:
Withdraw Cash
Check Balance
Deposit Funds
Transfer Funds
Change PIN
Print Statement
Contact Bank
Procedure:
I. Open Rational Rose Enterprise Edition.
II. Select Rational Unified Process from the dialog box.
III. Under use case view package select use case model.
IV. Now identify your actors according to the question. For Eg: Customer, ATM etc.
V. Create actors under the actor package. (Select Actors package Right click
New Actor).
VI. Add all the actors under the actor’s package.
VII. Now rename those actors as customer, ATM etc.
VIII. Create use cases under the use case package. (Select Use cases package Right
click New use case).
IX. Add all the use cases under the use cases package.
X. Now rename those use cases as Insert Card, Enter Password etc.
XI. Right Click Use cases view Package New use case diagram.
XII. Now rename it as “ATM Scenario”.
XIII. Now double click the ATM Scenario use case diagram under the use case view
package (Double click ATM Scenario Drag and drop the actors and use cases
in the Use Case Diagram: Use case view / ATM Scenario window.
XIV. Connect the actor with the use case through unidirectional associations.
XV. Draw as in the figure given below.
21
Use Case Diagrams:
a) ATM Scenario
Client
Transfer funds
22
b) An example of use case diagram for Bank ATM subsystem
23
d) An Example of Bank ATM Maintenance, Repair, Diagnostics Use Cases.
1. Class Diagram
Classes:
ATM
o Attributes: location, id
o Methods: validateCard(), ejectCard(), displayMessage()
Card
24
o Attributes: cardNumber, expiryDate, PIN
o Methods: validatePIN()
Account
o Attributes: accountNumber, balance
o Methods: checkBalance(), withdraw(), deposit(), transfer()
Transaction
o Attributes: transactionID, date, amount
o Methods: executeTransaction()
BankSystem
o Attributes: listOfAccounts
o Methods: authenticateCard(), processTransaction(), updateAccount()
Note:
A sample class diagram is provided below; use the class details of above to generate
different class diagrams. It is not limited!
25
V. By selecting class right click new attributes and new operations according to the
figure given below.
VI. Link all the classes by their associations.
VII. Draw as in the figure given below.
26
Class Diagram:
ATM Processing:
2. Activity Diagram
27
Activity Diagram for ATM Process:
Insert
card
Enter
PIN
Enter
transition
Any more transaction
No more transaction
Remove
card
28
3. State chart Diagram
Procedure – State chart Diagram
I. Right Click Logical View New state chart diagram.
II. Rename it as ATM scenario.
III. Double click ATM scenario Drag and drop the apt icons at the window.
IV. Draw as in the figure given below.
29
ATM Scenario State Transition Diagram
4. Sequence Diagram
Procedure – Sequence Diagram
I. Right Click Logical View New sequence diagram.
II. Rename it as ATM Process.
III. Double click ATM Process Drag and drop the apt icons at the window.
IV. Draw as in the figure given below.
30
Sequence Diagram for ATM Processing:
ac : B : Bank
account client
1: Insert card
31
5. ATM scenario for Collaboration diagram
Note:
If you are using Rational Rose Enterprise Edition software, simply click the F5 key
on your keyboard to build a collaboration diagram. Other software requires that you
design the diagram below exactly or adjust it to meet your needs.
32
6. ATM scenario for Component diagram
Procedure – Component Diagram
I. Right Click Component View New Component diagram.
II. Rename it as ATM Process.
III. Double click ATM Process Drag and drop the apt icons at the window.
IV. Draw as in the figure given below.
33
7. ATM Scenario for Deployment Diagram
Procedure – Deployment Diagram
I. Double click Deployment View.
II. Draw as in the figure given below.
To Generate Code:
i. Open the component diagram.
ii. Select the component individually right click open specification Language
ANSI C++.
iii. Similarly do all the components and set the language into ANSI C++.
34
iv. Select Realizes Right click the class name ATM, customer etc select assign.
35
36
v. Similarly do the same with all the components.
vi. At the final stage select Main Program.
vii. Right Click open specification Language ANSI C++ Realizes Assign.
viii. Once realizes done right the Main Program ANSI C++ Generate Code.
(Select your path where to generate the code).
37
Sample Code:
#ifndef ATM_H_HEADER_INCLUDED_993CE905
#define ATM_H_HEADER_INCLUDED_993CE905
//##ModelId=66C357B1007F
class ATM
{
};
#endif /* ATM_H_HEADER_INCLUDED_993CE905 */
Result:
The above program was successfully compiled, and codes were generated.
38
Experiment: 6
Design the Use case diagram, Class Diagram, Activity diagram, Sequence diagram,
Collaboration diagram, Deployment diagram and also generate the code automatically
by testing the test cases for Library Management System Operations by using the rational
rose enterprise edition software.
Software Required:
Rational Rose Enterprise Edition / MS Visio / Visual Paradigm
Procedure:
I. Open Rational Rose Enterprise Edition.
II. Select Rational Unified Process from the dialog box.
III. Under use case view package select use case model.
IV. Now identify your actors according to the question. For Eg: User tc.
V. Create actors under the actor package. (Select Actors package Right click
New Actor).
VI. Add all the actors under the actor’s package.
VII. Now rename those actors as User, Librarian etc.
39
VIII. Create use cases under the use case package. (Select Use cases package Right
click New use case).
IX. Add all the use cases under the use cases package.
X. Now rename those use cases as Issue Book etc.
XI. Right Click Use cases view Package New use case diagram.
XII. Now rename it as “Librarian Scenario”.
XIII. Now double click the Librarian Scenario use case diagram under the use case view
package (Double click LMS Scenario Drag and drop the actors and use cases
in the Use Case Diagram: Use case view / Librarian Scenario window.
XIV. Connect the actor with the use case through unidirectional associations.
XV. Draw as in the figure given below.
Purchase
Register
Lends
Reserve
Librarian1 User1
Update
Take
Reservation Return
3. Class Diagram
Procedure – Class Diagram
VIII. Right Click Logical View New Class diagram.
IX. Rename it as Library System.
X. Double click Library Processing Drag and drop the class icon at the window.
40
XI. While dropping there might be a chance of getting actor symbol at the window (To
Change it into class Right Click Open specification Make the stereotype as
blank, so that you will see only the class).
XII. By selecting class right click new attributes and new operations according to the
figure given below.
XIII. Link all the classes by their associations.
XIV. Draw as in the figure given below.
41
Class Diagram – Library Management System:
4. Activity Diagram
42
Activity Diagram for Library Management System:
43
5. Sequence Diagram
Procedure – Sequence Diagram
V. Right Click Logical View New sequence diagram.
VI. Rename it as Library Process.
VII. Double click Library Process Drag and drop the apt icons at the window.
VIII. Draw as in the figure given below.
44
6. Library scenario for Collaboration diagram
Note:
If you are using Rational Rose Enterprise Edition software, simply click the F5 key
on your keyboard to build a collaboration diagram. Other software requires that you
design the diagram below exactly or adjust it to meet your needs.
1.User id
2.Register
3.Receive
8.Return
User Librarian
7.Take
4.Valid 2.checks
5.Not 9.Update
Data base
45
Borrow_books
Book
registrat...
Provides
To Generate Code:
ix. Open the component diagram.
46
x. Select the component individually right click open specification Language
ANSI C++.
xi. Similarly do all the components and set the language into ANSI C++.
xii. Select Realizes Right click the class name User, Librarian etc select assign.
xiii. Similarly do the same with all the components.
xiv. At the final stage select Main Program.
xv. Right Click open specification Language ANSI C++ Realizes Assign.
xvi. Once realizes done right the Main Program ANSI C++ Generate Code.
(Select your path where to generate the code).
Sample Code:
#ifndef LIBRARY_H_HEADER_INCLUDED_993CE905
#define LIBRARY_H_HEADER_INCLUDED_993CE905
//##ModelId=66C357B1007F
Class Library
{
};
#endif /* LIBRARY_H_HEADER_INCLUDED_993CE905 */
Result:
The above program was successfully compiled, and codes were generated.
47
Experiment: 7
Design the Use case diagram, Class Diagram, Activity diagram, Sequence diagram,
Component diagram, Deployment Model for GU - SCSE.
School of Computer Science and Engineering (GU) system. We'll include the Use Case
Diagram, Class Diagram, Activity Diagram, Sequence Diagram, Component Diagram,
and Deployment Diagram.
Actors:
Student
Faculty
Administrator
Registrar
Use Cases:
Student:
o Register for Courses
o View Grades
o View Timetable
o Submit Assignments
o View Course Materials
Faculty:
o Create/Update Course
o Grade Assignments
o Post Course Materials
o View Class Roster
Administrator:
o Manage Student Records
o Manage Faculty Records
o Manage Course Catalog
o Generate Reports
Registrar:
o Enroll Students in Courses
o Manage Timetable
o Issue Transcripts
sql
Copy code
+ +
| School of Computer Science and |
| Engineering System |
| |
48
| + + + + |
| | Student | | Faculty | |
| + + + + |
| | | | | |
| | + Register | | + Create/ | |
| | for Courses | | Update | |
| | + View Grades | | Course | |
| | + View Timetable| | + Grade | |
| | + Submit | | Assignments| |
| | Assignments | | + Post | |
| | + View Course | | Course | |
| | Materials | | Materials | |
| + + + + |
| |
| + + + + |
| | Administrator | | Registrar | |
| + + + + |
| | | | | |
| | + Manage | | + Enroll | |
| | Student | | Students | |
| | Records | | in Courses| |
| | + Manage | | + Manage | |
| | Faculty | | Timetable | |
| | Records | | + Issue | |
| | + Manage | | Transcripts| |
| | Course | | | |
| | Catalog | | | |
| | + Generate | | | |
| | Reports | | | |
| + + + + |
+ +
2. Class Diagram
Classes:
Student
o Attributes: studentID, name, email, enrolledCourses
o Methods: registerCourse(), viewGrades(), viewTimetable(),
submitAssignment()
Faculty
o Attributes: facultyID, name, email, coursesTaught
o Methods: createCourse(), gradeAssignment(), postMaterials(), viewRoster()
Course
o Attributes: courseID, title, description, credits, schedule
o Methods: addMaterial(), updateCourse(), assignGrade()
Administrator
o Attributes: adminID, name, email
o Methods: manageStudentRecords(), manageFacultyRecords(),
manageCourseCatalog(), generateReports()
49
Registrar
o Attributes: registrarID, name, email
o Methods: enrollStudents(), manageTimetable(), issueTranscripts()
Assignment
o Attributes: assignmentID, title, dueDate, courseID
o Methods: submit(), grade()
Class Diagram:
scss
Copy code
+ +
| Student |
+ +
| - studentID |
| - name |
| - email |
| - enrolledCourses|
+ +
| + registerCourse() |
| + viewGrades() |
| + viewTimetable() |
| + submitAssignment()|
+ +
|
|
v
+ +
| Course |
+ +
| - courseID |
| - title |
| - description |
| - credits |
| - schedule |
+ +
| + addMaterial() |
| + updateCourse() |
| + assignGrade() |
+ +
|
|
v
+ +
| Assignment |
+ +
| - assignmentID |
| - title |
| - dueDate |
| - courseID |
50
+ +
| + submit() |
| + grade() |
+ +
|
|
v
+ +
| Faculty |
+ +
| - facultyID |
| - name |
| - email |
| - coursesTaught |
+ +
| + createCourse() |
| + gradeAssignment()|
| + postMaterials() |
| + viewRoster() |
+ +
|
|
v
+ +
| Administrator |
+ +
| - adminID |
| - name |
| - email |
+ +
| + manageStudentRecords() |
| + manageFacultyRecords() |
| + manageCourseCatalog() |
| + generateReports() |
+ +
|
|
v
+ +
| Registrar |
+ +
| - registrarID |
| - name |
| - email |
+ +
| + enrollStudents() |
| + manageTimetable()|
| + issueTranscripts() |
+ +
51
3. Activity Diagram
sql
Copy code
+ +
| Start |
+ +
|
v
+ +
| Login to System |
+ +
|
v
+ +
| Search Courses |
+ +
|
v
+ +
| Select Course |
+ +
|
v
+ +
| Check Availability|
+ +
|
v
+ +
| Register for Course|
+ +
|
v
+ +
| Confirmation |
+ +
|
v
+ +
| End |
+ +
4. Sequence Diagram
scss
52
Copy code
Student System Course Registrar
| | | |
| Login() | | |
|------------>| | |
| | | |
| SearchCourses() | | |
|------------>| | |
| | RetrieveCourses() | |
| |<------------ | |
| | | |
| SelectCourse() | | |
|------------>| | |
| | | |
| | CheckAvailability() | |
| |<------------ | |
| | | |
| RegisterForCourse() | | |
|------------>| | ProcessRegistration()|
| | |< ------------- |
| | | |
| | Confirmation()| |
|<------------ | | |
| | | |
5. Component Diagram
Components:
Component Diagram:
sql
Copy code
+ + + + + +
| User Interface |----->| Application |----->| Database |
| | | Server | | |
+ + + + + +
|
v
+ +
| Authentication Service |
53
+ +
6. Deployment Diagram
Nodes:
Client Machine
o Hosts User Interface
Application Server
o Hosts Application Server component and Authentication Service
Database Server
o Hosts the Database
Deployment Diagram:
sql
Copy code
+ + + +
| Client Machine | | Application Server |
| | | |
|+ +| |+ +|
| | User || | | Application | |
| | Interface | | | | Server ||
|+ +| |+ +|
+-----------------+ | | Authentication | |
| | Service ||
|+ +|
+ +
|
v
+ +
| Database Server |
| |
|+ +|
| | Database | |
|+ +|
+ +
These diagrams provide a comprehensive overview of the School of Computer Science and
Engineering system, including its actors, components, and interactions. They cover the main
functionalities and show how different parts of the system work together.
54
Experiment: 8
To develop a Railway Reservation System that allows users to book, cancel, and manage
train reservations, enabling efficient and user-friendly railway service management
55
+ +
| Railway Reservation System |
| |
| + + + +|
| | Passenger | | Booking | |
| +-----------------+ | Agent | |
| | | +--------- + |
| | + Search Trains | | + Assist | |
| | + Book Ticket | | Booking | |
| | + Cancel Booking| | + Cancel | |
| | + View History | | Booking | |
| | + Modify Booking| | + Modify | |
| | | | Booking | |
| +-----------------+ | + View ||
| | History | |
| + + + +|
| | Admin | |
| + ---------------- + |
| | | |
| | + Manage Train | |
| | Schedules | |
| | + Manage Train | |
| | Details | |
| | + Generate | |
| | Reports | |
| | + Manage Users | |
| + ---------------- + |
| |
| + ---------------- + |
| | Train System | |
| + ---------------- + |
| | | |
| | + Validate Ticket| |
| | + Update Train | |
56
| | Status | |
| | + Notify System | |
| | of Changes | |
| +-----------------+ |
+ +
2. Class Diagram
Classes:
Passenger
o Attributes: passengerID, name, email, phone
o Methods: searchTrains(), bookTicket(), cancelBooking(),
viewBookingHistory(), modifyBooking()
Booking Agent
o Attributes: agentID, name, email
o Methods: assistBooking(), cancelBooking(), modifyBooking(),
viewBookingHistory()
Admin
o Attributes: adminID, name, email
o Methods: manageTrainSchedules(), manageTrainDetails(), generateReports(),
manageUsers()
Train
o Attributes: trainID, trainNumber, route, schedule, seatsAvailable
o Methods: updateStatus(), getTrainDetails()
Booking
o Attributes: bookingID, passengerID, trainID, bookingDate, status
o Methods: createBooking(), cancelBooking(), modifyBooking()
Schedule
o Attributes: scheduleID, trainID, departureTime, arrivalTime, source,
destination
o Methods: updateSchedule()
Ticket
o Attributes: ticketID, bookingID, seatNumber, issueDate
o Methods: validateTicket()
Class Diagram:
scss
57
Copy code
+ +
| Passenger |
+ +
| - passengerID |
| - name |
| - email |
| - phone |
+ +
| + searchTrains() |
| + bookTicket() |
| + cancelBooking()|
| + viewBookingHistory() |
| + modifyBooking() |
+ +
|
|
v
+ +
| Booking |
+ +
| - bookingID |
| - passengerID |
| - trainID |
| - bookingDate |
| - status |
+ +
| + createBooking()|
| + cancelBooking()|
| + modifyBooking()|
+ +
|
|
v
58
+ +
| Train |
+ +
| - trainID |
| - trainNumber |
| - route |
| - schedule |
| - seatsAvailable |
+ +
| + updateStatus() |
| + getTrainDetails() |
+ +
|
|
v
+ +
| Schedule |
+ +
| - scheduleID |
| - trainID |
| - departureTime |
| - arrivalTime |
| - source |
| - destination |
+ +
| + updateSchedule() |
+ +
|
|
v
+ +
| Ticket |
+ +
| - ticketID |
59
| - bookingID |
| - seatNumber |
| - issueDate |
+ +
| + validateTicket() |
+ +
|
|
v
+ +
| Booking Agent |
+ +
| - agentID |
| - name |
| - email |
+ +
| + assistBooking()|
| + cancelBooking()|
| + modifyBooking()|
| + viewBookingHistory() |
+ +
|
|
v
+ +
| Admin |
+ +
| - adminID |
| - name |
| - email |
+ +
| + manageTrainSchedules() |
| + manageTrainDetails() |
| + generateReports() |
60
| + manageUsers() |
+ +
3. Activity Diagram
Activity Diagram for Booking a Ticket:
sql
Copy code
+ +
| Start |
+ +
|
v
+ +
| Search Trains |
+ +
|
v
+ +
| Select Train and |
| Enter Details |
+ +
|
v
+ +
| Check Seat |
| Availability |
+ +
|
v
+ +
| Confirm Booking |
+ +
|
v
+ +
61
| Payment Process |
+ +
|
v
+ +
| Generate Ticket |
+ +
|
v
+ +
| End |
+ +
4. Sequence Diagram
Sequence Diagram for Booking a Ticket:
scss
Copy code
Passenger System Train Booking
| | | |
| SearchTrains()| | |
|-------------->| | |
| | RetrieveTrainDetails() |
| |------------>| |
| | | |
| | | TrainDetails() |
| |<------------| |
| | | |
| SelectTrain() | | |
|-------------->| | |
| | | |
| | CheckAvailability() |
| |------------>| |
| | | Availability() |
| |<------------| |
| | | |
62
| ConfirmBooking() | | |
|-------------->| | |
| | | |
| | CreateBooking() | |
| |----------- >| |
| | | |
| | | BookingCreated() |
| |<------------| |
| | | |
| GenerateTicket() | | |
|-------------->| | |
| | | |
| | GenerateTicket() | |
| |----------- >| |
| | | TicketGenerated() |
| |<------------| |
| | | |
5. Component Diagram
Components:
User Interface (UI)
o Handles user interactions, booking forms, and ticket generation
Application Server
o Business logic for booking, cancellations, and updates
Train Management Service
o Manages train schedules, seat availability, and status updates
Database
o Stores passenger details, bookings, train schedules, and tickets
Component Diagram:
sql
Copy code
+ + + + + +
| User Interface |----->| Application Server|----->| Train |
| | | | | Management |
| | | | | Service |
63
+ + + + + +
|
v
+ +
| Database |
+ +
6. Deployment Diagram
Nodes:
Client Machine
o Hosts the User Interface
Application Server
o Hosts the Application Server and Train Management Service
Database Server
o Hosts the Database
Deployment Diagram:
sql
Copy code
+ + + +
| Client Machine | | Application Server |
| | | |
|+ +| |+ +|
| | User || | | Application ||
| | Interface | | | | Server ||
|+ +| |+ +|
+ + |+ +|
| | Train Management|
| | Service |
|+ +|
|
v
+ +
| Database Server |
| |
|+ +|
64
| | Database ||
|+ +|
+ +
These diagrams provide a detailed view of the Railway Reservation System, capturing user
interactions, system components, and deployment strategies. They help in understanding how
the system works and how different parts interact with each other.
65
Experiment: 9
To develop an Expert System for prescribing medicines based on given symptoms,
enabling Remote Diagnostics and Patient/Hospital Management.
66
+ +
| Expert System for |
| Prescribing Medicines |
| Based on Symptoms |
| |
| + + + + |
| | Patient | | Doctor | |
| + + + + |
| | | | | |
| | + Submit | | + Review | |
| | Symptoms | | Symptoms | |
| | + View | | + Diagnose | |
| | Prescriptions| | Condition | |
| | + Update | | + Prescribe | |
| | Information | | Medication| |
| | + Request | | + View | |
| | Remote | | Patient | |
| | Consultation | | History | |
| +----------------+ | + Consult | |
| | with | |
| +----------------+ | Remote | |
| | Administrator | | Diagnostics | |
| + + + + |
| | | |
| | + Manage | |
| | User Accounts| |
| | + Manage | |
| | Medicine | |
| | Database | |
| | + Generate | |
| | Reports | |
| | + Oversee | |
| | System | |
| | Operations | |
67
| +----------------+ |
| |
| +----------------+ |
| | Remote Diagnostic | |
| | System | |
| +----------------+ |
| | | |
| | + Analyze | |
| | Symptoms | |
| | + Recommend | |
| | Initial | |
| | Diagnosis | |
| | + Validate | |
| | Prescriptions| |
| +----------------+ |
+ +
2. Class Diagram
Classes:
Patient
o Attributes: patientID, name, symptoms, medicalHistory, contactInformation
o Methods: submitSymptoms(), viewPrescriptions(), updateInformation(),
requestRemoteConsultation()
Doctor
o Attributes: doctorID, name, specialty, contactInformation
o Methods: reviewSymptoms(), diagnoseCondition(), prescribeMedication(),
viewPatientHistory(), consultRemoteDiagnostics()
Administrator
o Attributes: adminID, name, contactInformation
o Methods: manageUserAccounts(), manageMedicineDatabase(),
generateReports(), overseeSystemOperations()
Symptom
o Attributes: symptomID, description, severity
o Methods: getDescription(), getSeverity()
Diagnosis
68
o Attributes: diagnosisID, condition, recommendedTreatment
o Methods: getCondition(), getRecommendedTreatment()
Medication
o Attributes: medicineID, name, dosage, sideEffects
o Methods: getDosage(), getSideEffects()
Prescription
o Attributes: prescriptionID, patientID, medicationID, issueDate
o Methods: createPrescription(), updatePrescription()
RemoteDiagnosticSystem
o Attributes: systemID, analysisAlgorithm
o Methods: analyzeSymptoms(), recommendDiagnosis(), validatePrescriptions()
Class Diagram:
scss
Copy code
+ +
| Patient |
+ +
| - patientID |
| - name |
| - symptoms |
| - medicalHistory |
| - contactInfo |
+ +
| + submitSymptoms() |
| + viewPrescriptions()|
| + updateInformation() |
| + requestRemoteConsultation() |
+ +
|
|
v
+ +
| Symptom |
+ +
69
| - symptomID |
| - description |
| - severity |
+ +
| + getDescription()|
| + getSeverity() |
+ +
|
|
v
+ +
| Diagnosis |
+ +
| - diagnosisID |
| - condition |
| - recommendedTreatment |
+ +
| + getCondition() |
| + getRecommendedTreatment() |
+ +
|
|
v
+ +
| Medication |
+ +
| - medicineID |
| - name |
| - dosage |
| - sideEffects |
+ +
| + getDosage() |
| + getSideEffects() |
+ +
70
|
|
v
+ +
| Prescription |
+ +
| - prescriptionID |
| - patientID |
| - medicationID |
| - issueDate |
+ +
| + createPrescription() |
| + updatePrescription() |
+ +
|
|
v
+ +
| Doctor |
+ +
| - doctorID |
| - name |
| - specialty |
| - contactInfo |
+ +
| + reviewSymptoms() |
| + diagnoseCondition()|
| + prescribeMedication()|
| + viewPatientHistory() |
| + consultRemoteDiagnostics() |
+ +
|
|
v
71
+ +
| Administrator |
+ +
| - adminID |
| - name |
| - contactInfo |
+ +
| + manageUserAccounts() |
| + manageMedicineDatabase()|
| + generateReports() |
| + overseeSystemOperations() |
+ +
|
|
v
+ +
| RemoteDiagnosticSystem |
+ +
| - systemID |
| - analysisAlgorithm |
+ +
| + analyzeSymptoms() |
| + recommendDiagnosis() |
| + validatePrescriptions() |
+ +
3. Activity Diagram
Activity Diagram for Prescribing Medication:
sql
Copy code
+ +
| Start |
+ +
|
v
72
+ +
| Submit Symptoms |
+ +
|
v
+ +
| Analyze Symptoms |
+ +
|
v
+ +
| Diagnose Condition|
+ +
|
v
+ +
| Recommend |
| Medication |
+ +
|
v
+ +
| Generate Prescription |
+ +
|
v
+ +
| Notify Patient |
+ +
|
v
+ +
| End |
+ +
73
4. Sequence Diagram
Sequence Diagram for Prescribing Medication:
scss
Copy code
Patient System RemoteDiagnosticSystem Doctor
| | | |
| SubmitSymptoms()| | |
|---------------> | | |
| | AnalyzeSymptoms()| |
| |---------------->| |
| | | Analyze() |
| | |<--------------- |
| | DiagnoseCondition()| |
| |---------------->| |
| | | Diagnose() |
| | |<--------------- |
| | RecommendMedication()| |
| |---------------->| |
| | | Recommend() |
| | |<--------------- |
| | GeneratePrescription()| |
| |---------------->| |
| | | Generate() |
| | |<--------------- |
| | NotifyPatient() | |
| |<---------------- | |
| | | |
5. Component Diagram
Components:
User Interface (UI)
o Handles interactions with the patient and doctor, including symptom
submission and prescription viewing
Expert System Engine
o Processes symptoms, diagnoses conditions, and recommends treatments
74
Remote Diagnostic Service
o Analyzes symptoms and provides initial diagnosis
Database
o Stores patient records, medical history, medications, and prescriptions
Component Diagram:
sql
Copy code
+ + + + + +
| User Interface |----->| Expert System Engine |----->| Database |
| | | | | |
| | | +-----------------+ | | + ------------- + |
| | | | Symptom || | | Patient ||
| | | | Diagnosis || | | MedicalData | |
| | | | Medication || | | Prescriptions| |
| | | + ---------------- + | | + ------------- + |
+ + + + + +
|
v
+ +
| Remote Diagnostic Service|
| |
|+ +|
| | Analyze Symptoms ||
| | Recommend Diagnosis | |
| | Validate Prescriptions | |
|+ +|
+ +
6. Deployment Diagram
Nodes:
Client Device
o Hosts the User Interface
Application Server
o Hosts the Expert System Engine and Remote Diagnostic Service
Database Server
75
o Hosts the Database
Deployment Diagram:
sql
Copy code
+ + + +
| Client Device | | Application Server |
| | | |
|+ +| |+ +|
| | User || | | Expert System ||
| | Interface || | | Engine ||
|+ +| |+ +|
+ + |+ +|
| | Remote Diagnostic | |
| | Service ||
|+ +|
|
v
+ +
| Database Server |
| |
|+ +|
| | Database ||
|+ +|
+ +
These diagrams provide a structured overview of the Expert System, including user
interactions, system components, and deployment strategies. They are essential for
understanding the system's architecture and ensuring that all functionalities are well
integrated.
76
Experiment: 10
To develop a test case for unit testing by using JUnit Tool.
Aim:
The aim of developing a test case for unit testing is to ensure that individual components of a
software application function correctly and reliably. Key objectives include:
1. Verify Functionality: Confirm that each unit of code behaves as expected.
2. Identify Bugs Early: Detect and fix defects before they propagate to later stages.
3. Facilitate Refactoring: Ensure that code changes do not break existing functionality.
4. Improve Code Quality: Encourage better design practices and maintainability.
5. Enhance Documentation: Provide clear examples of how code is expected to behave.
6. Support Continuous Integration: Automate testing to maintain code stability.
7. Increase Confidence: Boost trust in the reliability of the software system.
Tool Download
IntelliJ IDEA
https://www.jetbrains.com/idea/download/?section=windows
Procedure:
A. Open a new Project.
B. Select Java name as Junittesting click gradle Groovy click create
button.
C. Under your project click buildgradle copy and paste only the dependency under
parenthesis.
D. Right-click on the src/main/java directory, select "New" > "Java Class", and name it
(e.g., Calculator.java):
public class Calculator {
public int add(int a, int b) {
return a + b;
}
}
E. Right-click on the src/test/java directory, select "New" > "Java Class", and name it
(e.g., CalculatorTest.java):
import static org.junit.jupiter.api.Assertions.assertEquals;
77
import org.junit.jupiter.api.Test;
78
Note: Test was failed
JUnit Overview
JUnit is a widely used testing framework for Java applications. It provides annotations,
assertions, and test runners to facilitate the creation and execution of unit tests, ensuring that
individual parts of the code (units) function correctly.
Key Features
1. Annotations: JUnit uses annotations to define test methods and manage test execution:
o @Test: Marks a method as a test case.
o @Before: Runs before each test method, often used for setup.
o @After: Runs after each test method, often used for cleanup.
o @BeforeClass and @AfterClass: Run once before and after all tests in a class.
2. Assertions: JUnit provides a variety of assertion methods to check expected outcomes:
o assertEquals(expected, actual): Checks if two values are equal.
o assertTrue(condition): Checks if a condition is true.
o assertFalse(condition): Checks if a condition is false.
o assertNull(object): Checks if an object is null.
o assertNotNull(object): Checks if an object is not null.
3. Test Runners: JUnit provides different test runners to execute tests. The most common
one is the JUnitCore class, which runs tests and outputs results.
4. Parameterized Tests: Allows running the same test with different input values.
79
5. Integration with Build Tools: JUnit easily integrates with build tools like Maven and
Gradle, making it straightforward to automate testing.
Assertion:
An assertion is a statement in the Java programming language that enables you to test your
assumptions about your program. For example, if you write a method that calculates the speed
of a particle, you might assert that the calculated speed is less than the speed of light. Each
assertion contains a boolean expression that you believe will be true when the assertion
executes. If it is not true, the system will throw an error. By verifying that the boolean
expression is indeed true, the assertion confirms your assumptions about the behavior of your
program, increasing your confidence that the program is free of errors. Experience has shown
that writing assertions while programming is one of the quickest and most effective ways to
detect and correct bugs. As an added benefit, assertions serve to document the inner workings
of your program, enhancing maintainability.
Result:
The experiment successfully generated assertions that validate the user’s assumptions,
confirming the expected behavior of individual components. This process in IntelliJ IDEA
ensured that each unit of code functioned correctly in isolation, contributing to overall software
quality.
80
Experiment No: 11
To develop a test case for Integration testing by using JUnit Tool.
Aim:
The aim of developing a test case for integration testing is to verify that multiple components
of a software application work together as intended. This includes ensuring that:
1. Correct Interaction: Validate the interactions between integrated units (e.g., services,
databases) to confirm they collaborate properly.
2. Data Flow: Ensure data is correctly passed between components without errors.
3. System Behavior: Check that the system behaves as expected when components are
integrated, identifying any interface issues.
4. Identify Integration Issues: Detect problems arising from the integration of different
modules early in the development cycle.
Tool Download
IntelliJ IDEA
https://www.jetbrains.com/idea/download/?section=windows
Procedure:
A. Open a new Project.
B. Select Java name as Junittesting click gradle Groovy click create
button.
C. Under your project click buildgradle copy and paste only the dependencies.
(Fully)
plugins {
id 'java'
}
group 'com.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
81
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
}
test {
useJUnitPlatform()
}
Sync Gradle:
Click on the Refresh icon in the Gradle tool window to sync the dependencies.
package com.example;
package com.example;
82
public CalculatorService(CalculatorRepository
repository) {
this.repository = repository;
}
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@BeforeEach
public void setUp() {
CalculatorRepository repository = new CalculatorRepository();
calculatorService = new CalculatorService(repository);
}
83
@Test
public void testAdd() {
assertEquals(5, calculatorService.add(2, 3));
}
@Test
public void testFetchData() {
assertEquals("Sample Data", calculatorService.fetchData());
}
}
Sample Output:
84
Note: Test was failed
Result:
The experiment successfully generated assertions that validate the user’s assumptions,
confirming the correct functionality of integrated components. This process in IntelliJ IDEA
ensured that all interactions between modules behaved as expected, enhancing overall software
reliability.
85
Experiment 12
Test Case Name : Boundary Value Analysis for triangle problem
Design and develop a program in a Java language to solve the triangle problem defined as
follows. Accept three integers which are supposed to be the three sides of a triangle and
determine the three values represent an equilateral triangle, isosceles triangle, and scalene
triangle or they do not form a triangle at all. Assume that the upper limit for the size of any side
is 10. Derive test cases for your program based on boundary value analysis, and execute the
test cases and discuss the results.
Source Code:
import java.util.Scanner;
if(a<0 || a>10)
{
System.out.println("a is out of range");
t=1;
}
if(b<0 || b>10)
{
System.out.println("b is out of range");
86
t=1;
}
if(c<0 || c>10)
{
System.out.println("c is out of range");
t=1;
}
if(!(t==1))
{
if(a<b+c && b<a+c && c<a+b)
{
System.out.println("triangle can be formed\n");
if((a==b)&&(b==c))
System.out.println("Equilateral triangle");
else if((a!=b)&&(a!=c)&&(b!=c))
System.out.println("Scalene triangle");
else
System.out.println("Isosceles triangle");
}
else
Sample Output
87
Test Case Name : Boundary Value Analysis for triangle problem
Experiment Number 12
Test Data : Enter the 3 integer value (a, b and c)
Brief Description: Check whether given value for an Equilateral, Isosceles, Scalene
triangle or can't from a triangle.
88
4 Enter the normal value for a, 5 5 9 Should display the message
b and max – 1 value for c Isosceles triangle
5 Enter the normal value for a, 5 5 10 Should display the message
b and max value for c Not a triangle
6 Enter the normal value for a 5 1 5 Should display the message
, c and min value for b Isosceles triangle
7 Enter the normal value for a, 5 2 5 Should display the message
c and min + 1 for b Isosceles triangle
8 Enter the normal value for a 5 9 5 Should display the message
, c and max – 1 value for b Isosceles triangle
9 Enter the normal value for a, 5 10 5 Should display the message
c and max value for b Not a triangle
10 Enter the normal value for 1 5 5 Should display the message
b, c and min value for a Isosceles triangle
11 Enter the normal value for 2 5 5 Should display the message
b, c and min + 1 value for a Isosceles triangle
12 Enter the normal value for 9 5 5 Should display the message
b, c and max – 1 for a Isosceles triangle
13 Enter the normal value for 10 5 5 Should display the message
b, c and max value for a Not a triangle
14 Enter the value for a, b, c 2 3 4 Should display the message
Scalene triangle
Note:
After executing the Java program, record the "Actual Output and Status" of your test
cases.
89