SoftwareEngineeringLab
SoftwareEngineeringLab
Experiment No. 1
Class Diagram of Online Railway Reservation System
Creating a class diagram for an online railway reservation system involves modeling the various entities and
their interactions required to manage reservations, trains, passengers, and ticketing. Here’s a simplified class
diagram to illustrate the key components of such a system:
1. Train
Attributes:
o trainID: int
o trainName: string
o source: string
o destination: string
o departureTime: datetime
o arrivalTime: datetime
o totalSeats: int
o availableSeats: int
Methods:
o updateSeats(int): void
o getSchedule(): string
2. Passenger
Attributes:
o passengerID: int
o name: string
o email: string
o phoneNumber: string
Methods:
o bookTicket(Ticket): void
o cancelTicket(Ticket): void
o viewBookingHistory(): List<Ticket>
3. Ticket
Attributes:
o ticketID: int
o trainID: int
o passengerID: int
o bookingDate: datetime
o travelDate: datetime
o seatNumber: int
o status: string (e.g., "booked", "canceled", "completed")
Methods:
o generateTicket(): string
4
o cancelTicket(): void
4. Reservation
Attributes:
o reservationID: int
o ticketID: int
o passengerID: int
o reservationDate: datetime
o status: string (e.g., "confirmed", "pending", "canceled")
Methods:
o confirmReservation(): void
o cancelReservation(): void
5. Schedule
Attributes:
o scheduleID: int
o trainID: int
o date: datetime
o departureTime: datetime
o arrivalTime: datetime
Methods:
o updateSchedule(): void
o getTrainSchedule(): string
6. Payment
Attributes:
o paymentID: int
o ticketID: int
o amount: float
o paymentDate: datetime
o status: string (e.g., "completed", "failed")
Methods:
o processPayment(): boolean
o refundPayment(): void
Relationships:
Notes:
Train schedules might be managed separately from train details if trains run on different schedules or
routes.
Payment could be a more detailed class, depending on the complexity of the payment processing
system.
6
Experiment No.2
Class Diagram Of Library Management System
Creating a class diagram for a library management system involves identifying the main classes that would be
involved in managing the various aspects of a library. These classes usually include entities such as books, members, and
staff, and their interactions.
1. Book
Attributes:
- `bookID`: int
- `title`: string
- `author`: string
- `publisher`: string
- `publicationYear`: int
- `ISBN`: string
- `availableCopies`: int
Methods:
- `checkAvailability()`: boolean
- `updateCopies(int)`: void
2. Member
Attributes:
- `memberID`: int
- `name`: string
- `address`: string
- `phoneNumber`: string
- `email`: string
- `membershipDate`: date
- Methods:
7
- `borrowBook(Book)`: boolean
- `returnBook(Book)`: void
- `reserveBook(Book)`: boolean
3. Staff
Attributes:
- `staffID`: int
- `name`: string
- `position`: string
- `email`: string
Methods:
- `addBook(Book)`: void
- `removeBook(Book)`: void
- `updateBookInfo(Book)`: void
- `registerMember(Member)`: void
- `deregisterMember(Member)`: void
4. Transaction
Attributes:
- `transactionID`: int
- `memberID`: int
- `bookID`: int
- `transactionDate`: date
- `dueDate`: date
- `returnDate`: date
Methods:
- `calculateFine()`: float
- `recordTransaction()`: void
8
5. Reservation
Attributes:
- `reservationID`: int
- `memberID`: int
- `bookID`: int
- `reservationDate`: date
Methods:
- `cancelReservation()`: void
Relationships:
Notes:
- Library class can be included to manage the overall library operations, members, and books.
9
- Library might not always be a separate class in some diagrams but could be part of the system's operational logic.
This class diagram provides a foundation, but depending on the specific requirements or functionalities, you may need
to adjust or expand upon it.
10
Experiment No.3
Use-Case Model For Student Admission System in a University
A use case model for a student admission system in a university outlines the interactions between the various
actors (users) and the system to manage the student admission process. This model helps in understanding the
functional requirements and the interactions that different users have with the system.
Actors
Use Cases
Here's a textual representation of how the use case diagram would be structured:
11
1. Apply for Admission: Prospective students fill out an application form online or offline.
2. Submit Documents: Prospective students upload or submit required documents (e.g., transcripts,
recommendation letters).
3. Track Application Status: Prospective students log in to view the status of their application.
4. Review Applications: Admission officers evaluate the submitted applications based on criteria.
5. Request Additional Information: If needed, admission officers request further information from the
applicant.
6. Update Application Status: Admission officers update the status of the application to accepted,
rejected, or pending.
7. Send Admission Offer: Accepted students receive an official offer of admission.
8. Enroll in Program: Accepted students select and enroll in a specific program or course.
9. Generate Reports: University administrators create reports on application statistics, admission trends,
etc.
10. Manage Users: University administrators create, modify, or delete user accounts and roles.
11. Manage Programs and Courses: Administrators update or add new programs and courses to the
system.
12. Update Student Records: Registrars maintain and update student records post-admission.
This use case model provides a high-level view of the functional requirements of a student admission system
and the interactions between different types of users and the system.
12
Experiment No. 4
Develop Use Case Diagram for Library where a member can perform two operations:
Book and return a book is issue to a member after verifying his credentials
To develop a use case diagram for a library system where a member can perform operations to borrow and
return books, and where these operations are dependent on verifying the member's credentials, follow these
steps:
Actors
1. Library Member: The user of the library who can borrow and return books.
2. Library Staff: Responsible for verifying the credentials of the library members and processing book
transactions.
Use Cases
1. Borrow Book:
o Member: Initiates the request to borrow a book.
o Library Staff:
Verify Member Credentials: Staff verifies the member’s identity to ensure they are
eligible to borrow books.
Check Book Availability: Staff checks if the requested book is available in the library.
Issue Book: If credentials are verified and the book is available, the book is issued to the
member.
2. Return Book:
o Member: Returns a book to the library.
o Library Staff:
Verify Member Credentials: Staff verifies the member’s identity to ensure the return is
legitimate.
Accept Returned Book: Staff processes the return and updates the system to reflect that
the book is now available.
Visual Representation
Notes
Library Staff is responsible for both verifying member credentials and processing transactions.
Library Member interacts with the system to borrow and return books but relies on the library staff to
handle the behind-the-scenes verification and updating.
This diagram provides a high-level overview of the main interactions and roles within the library system related
to borrowing and returning books.
15
Experiment No.5
Use Case Diagram For a Travel Agent
A use case diagram for a travel agent system outlines the interactions between the various actors (users) and the
system to manage travel bookings, inquiries, and other related activities. The primary actors in this system are
the Customer and the Travel Agent. Below is a detailed breakdown and textual representation of the use case
diagram.
Actors
1. Customer: The individual who interacts with the travel agent system to book travel services.
2. Travel Agent: The professional who manages bookings, provides assistance, and handles customer
inquiries.
Use Cases
1. Search for Travel Options: The customer searches for available travel options such as flights, hotels,
and car rentals.
2. Book Travel: The customer books travel services based on their search results.
3. Cancel Booking: The customer cancels a previously made booking.
4. Modify Booking: The customer makes changes to an existing booking.
5. Make Inquiry: The customer asks for more information or clarifications about travel options.
6. Provide Travel Information: The travel agent provides information about travel options, pricing, and
other details.
7. Process Booking: The travel agent processes and confirms travel bookings made by customers.
8. Manage Cancellations: The travel agent handles and processes booking cancellations.
9. Update Travel Information: The travel agent updates information about travel options, prices, and
availability.
10. Generate Reports: The travel agent generates reports related to bookings, sales, and customer inquiries.
Here’s a textual representation of the use case diagram for a travel agent system:
16
Visual Representation
The visual representation of the use case diagram can be illustrated as follows:
17
This use case diagram provides a high-level overview of the interactions within a travel agent system, showcasing the
roles of both customers and travel agents in managing travel bookings and inquiries.
18
Experiment No.6
Uml Sequence Diagram for Information system For Online Book Store
Creating a UML sequence diagram for an online bookstore involves modeling the interactions between various
components of the system over time. Let's break down the key components and interactions typically found in
such a system.
Key Components
You can use a UML tool like Lucidchart, Microsoft Visio, or even online tools like draw.io to create a graphical
representation of this sequence diagram.
20
Experiment No.7
Uml Class And Sequence Diagram For Car Manufacturing
A Class Diagram is used to show the static structure of a system, depicting classes, their attributes, methods,
and relationships between classes.
For a car manufacturing system, the Class Diagram might include the following classes:
1. Car
o Attributes: model, engineType, color, price
o Methods: assemble(), paint(), testDrive()
2. Engine
o Attributes: engineType, horsepower, fuelType
o Methods: assemble(), test()
3. Transmission
o Attributes: transmissionType, numberOfGears
o Methods: assemble(), test()
4. Manufacturer
o Attributes: name, location
o Methods: produceCar(), testCar()
5. Supplier
o Attributes: name, contactInfo
o Methods: supplyParts()
6. ProductionLine
o Attributes: lineID, capacity
o Methods: startProduction(), stopProduction()
7. Worker
o Attributes: name, role, shift
o Methods: performTask()
Relationships:
Car has a composition relationship with Engine and Transmission (i.e., a Car "has a" Engine and
Transmission).
Manufacturer uses Supplier to get parts.
Manufacturer utilizes ProductionLine to produce cars.
ProductionLine involves Workers for different tasks.
A Sequence Diagram shows how objects interact in a particular sequence. Let’s consider the process of
manufacturing a car:
Summary
Class Diagram shows the structure of the car manufacturing system including key classes and their
relationships.
Sequence Diagram shows the process flow of manufacturing a car from order to delivery.
23
Experiment No.8
State transition Diagram For Online Air Reservation System
Creating a state transition diagram for an Online Air Reservation System involves mapping out the various
states of the system and how it transitions between these states based on different events. Here's a conceptual
outline for such a diagram:
States:
1. Idle/Start: Initial state where the system is waiting for user input.
2. Search Flights: User is searching for available flights.
3. Select Flight: User selects a flight from the search results.
4. Enter Passenger Details: User enters passenger details.
5. Payment: User proceeds to payment for the reservation.
6. Confirmation: System confirms the booking and provides a reservation number.
7. Cancel Reservation: User cancels the reservation.
8. Modify Reservation: User modifies the reservation details.
Transitions:
Diagram Representation:
In a state transition diagram, you would typically represent states as circles or rectangles, and transitions as
arrows between these states. Here's a simplified visual representation:
sql
Copy code
+-------------+
| Idle/Start |
+------+------+
|
24
v
+------+------+
| Search |
| Flights |
+------+------+
|
v
+------+------+
| Select |
| Flight |
+------+------+
|
v
+------+------+
| Enter |
| Passenger |
| Details |
+------+------+
|
v
+------+------+
| Payment |
+------+------+
/ \
/ \
v v
+------+-------+ +--------+
| Confirmation | | Enter |
+--------------+ | Passenger |
| Details |
+----------+
|
v
+-------+--------+
| Modify |
| Reservation |
+-------+--------+
|
v
+-------+--------+
| Payment |
+-------+--------+
|
v
+-------+--------+
| Confirmation |
+----------------+
This diagram helps in understanding the flow of operations and the states the system can be in, providing clarity
on user interactions and system responses.
25
Experiment N0.9
Deployment Diagram for Different Scenario of Railway System
Creating a deployment diagram for a railway system involves detailing how the various components of the
system are distributed across hardware nodes and how they interact with each other. Deployment diagrams are
part of UML (Unified Modeling Language) and help visualize the physical deployment of artifacts on nodes.
Here’s a general approach to creating a deployment diagram for a railway system with different scenarios:
Track Control System (TCS): Manages train movements, signals, and track switching.
Signal Control System (SCS): Controls the signaling along the tracks.
Train Management System (TMS): Manages train schedules, routes, and communications.
Station Management System (SMS): Handles ticketing, platform management, and passenger
information.
Communication System (CS): Facilitates communication between trains, stations, and control centers.
Maintenance System (MS): Manages the maintenance of tracks, trains, and other infrastructure.
User Interfaces: For operators, conductors, and passengers.
2. Nodes
Nodes represent physical hardware or virtual environments where components are deployed. Examples include:
Central Control Node: Hosts TCS, SCS, and some parts of TMS.
Station Node: Hosts SMS, communication interfaces, and local TMS components.
Train Node: Contains onboard TMS, communication interfaces, and sensor systems.
Maintenance Node: Hosts MS and diagnostic tools.
Communication Node: Dedicated to the Communication System.
o Diagnostic Tools
Communication Node:
o CS
Interactions:
Trains communicate with the central control node via the communication system.
Station systems interact with the central control node for scheduling and signal management.
Maintenance systems gather data from various nodes for diagnostics and updates.
Interactions:
Central control takes immediate action to reroute trains and update signals.
Stations handle emergency notifications and manage passenger information.
Trains follow emergency protocols and communicate critical information back to control centers.
Maintenance teams are alerted and dispatched based on emergency diagnostics.
Interactions:
Maintenance systems coordinate with central control for scheduling and operational adjustments.
Stations manage altered schedules and communicate changes to passengers.
Trains operate under modified schedules and report maintenance data.
Communication systems monitor and report maintenance impacts.
Diagram Example
Here’s a simplified representation of the deployment diagram for the Normal Operation scenario:
sql
Copy code
+---------------------------------------+
| Central Control Node |
| +-------------------------------+ |
| | TCS | |
| +-------------------------------+ |
| +-------------------------------+ |
| | SCS | |
| +-------------------------------+ |
| +-------------------------------+ |
| | TMS (Centralized) | |
| +-------------------------------+ |
+---------------------------------------+
| |
| |
+-----------------+ +------------------+
| Station Node | | Communication |
| +-----------+ | | Node |
| | SMS | | | +-----------+ |
| +-----------+ | | | CS | |
| +-----------+ | | +-----------+ |
| | Local TMS | | +------------------+
| +-----------+ |
| +-----------+ |
| | Comm. Intf.| |
| +-----------+ |
+-----------------+
|
|
+-----------------+
| Train Node |
| +-----------+ |
| | Onboard TMS | |
| +-----------+ |
| +-----------+ |
| | Comm. Intf.| |
| +-----------+ |
| +-----------+ |
28
| | Sensors | |
| +-----------+ |
+-----------------+
|
|
+-----------------+
| Maintenance Node|
| +-----------+ |
| | MS | |
| +-----------+ |
| +-----------+ |
| | Diagnostic | |
| | Tools | |
| +-----------+ |
+-----------------+
This diagram and its variations illustrate how different components of the railway system interact and are
deployed in various operational scenarios. Adjustments would be made based on the specific architecture and
requirements of the system you are modeling.
29
Experiment No. 10
Develop test cases for various white box and black box testing techniques
1. Statement Coverage
Example Code:
python
Copy code
def calculate_discount(price, discount_rate):
discounted_price = price
if discount_rate > 0:
discounted_price = price - (price * discount_rate / 100)
return discounted_price
Test Cases:
Test Case 1:
o Input: price = 100, discount_rate = 10
o Expected Output: 90.0
o Reasoning: Covers the condition where discount_rate > 0.
Test Case 2:
o Input: price = 100, discount_rate = 0
o Expected Output: 100.0
o Reasoning: Covers the scenario where discount_rate = 0.
2. Branch Coverage
Example Code:
python
Copy code
def check_even_odd(number):
if number % 2 == 0:
return 'Even'
else:
return 'Odd'
Test Cases:
Test Case 1:
o Input: number = 4
o Expected Output: Even
o Reasoning: Tests the true branch of the condition.
Test Case 2:
30
o Input: number = 5
o Expected Output: Odd
o Reasoning: Tests the false branch of the condition.
3. Path Coverage
Objective: Ensure all possible paths through the code are tested.
Example Code:
python
Copy code
def compute_value(x, y):
if x > y:
result = x + y
if result > 10:
return 'High'
else:
return 'Low'
else:
result = x - y
if result < 0:
return 'Negative'
else:
return 'Positive'
Test Cases:
Test Case 1:
o Input: x = 7, y = 3
o Expected Output: High
o Reasoning: Tests the path where x > y and result > 10.
Test Case 2:
o Input: x = 5, y = 7
o Expected Output: Negative
o Reasoning: Tests the path where x <= y and result < 0.
4. Condition Coverage
Objective: Ensure each condition in a decision is tested both true and false.
Example Code:
python
Copy code
def validate_age(age):
if age >= 18 and age <= 65:
return 'Valid'
else:
return 'Invalid'
Test Cases:
31
Test Case 1:
o Input: age = 20
o Expected Output: Valid
o Reasoning: Tests age >= 18 as true, age <= 65 as true.
Test Case 2:
o Input: age = 16
o Expected Output: Invalid
o Reasoning: Tests age >= 18 as false.
5. Loop Testing
Example Code:
python
Copy code
def sum_first_n(n):
total = 0
for i in range(n):
total += i
return total
Test Cases:
Test Case 1:
o Input: n = 5
o Expected Output: 10
o Reasoning: Tests multiple iterations (0, 1, 2, 3, 4).
Test Case 2:
o Input: n = 0
o Expected Output: 0
o Reasoning: Tests the loop with no iterations.
1. Equivalence Partitioning
Example Code:
python
Copy code
def categorize_age(age):
if age < 0:
return 'Invalid'
elif age < 13:
return 'Child'
elif age < 18:
return 'Teenager'
else:
32
return 'Adult'
Test Cases:
Test Case 1:
o Input: age = 5
o Expected Output: Child
o Reasoning: Tests age in the Child class.
Test Case 2:
o Input: age = 15
o Expected Output: Teenager
o Reasoning: Tests age in the Teenager class.
Test Case 3:
o Input: age = 25
o Expected Output: Adult
o Reasoning: Tests age in the Adult class.
Test Case 4:
o Input: age = -1
o Expected Output: Invalid
o Reasoning: Tests invalid age.
Example Code:
python
Copy code
def get_grade(marks):
if marks >= 90:
return 'A'
elif marks >= 80:
return 'B'
elif marks >= 70:
return 'C'
elif marks >= 60:
return 'D'
else:
return 'F'
Test Cases:
Test Case 1:
o Input: marks = 89
o Expected Output: C
o Reasoning: Tests just below the boundary between B and C.
Test Case 2:
o Input: marks = 90
o Expected Output: A
o Reasoning: Tests the boundary where grade changes to A.
Test Case 3:
33
o Input: marks = 80
o Expected Output: B
o Reasoning: Tests the boundary where grade changes to B.
Example Code:
python
Copy code
def check_login(username, password):
if username == 'admin' and password == 'password123':
return 'Login successful'
elif username == 'admin' or password == 'password123':
return 'Login failed'
else:
return 'Invalid username or password'
Test Cases:
Example Code:
python
Copy code
class LightSwitch:
def __init__(self):
self.state = 'OFF'
def toggle(self):
if self.state == 'OFF':
self.state = 'ON'
else:
self.state = 'OFF'
return self.state
Test Cases:
Test Case 1:
o Input: toggle()
o Expected Output: ON
o Reasoning: Tests transition from OFF to ON.
34
Test Case 2:
o Input: toggle()
o Expected Output: OFF
o Reasoning: Tests transition from ON back to OFF.
Example Code:
python
Copy code
def process_order(order):
if order.is_valid():
if order.payment_successful():
return 'Order processed'
else:
return 'Payment failed'
else:
return 'Invalid order'
Test Cases:
Test Case 1:
o Input: order = valid order with successful payment
o Expected Output: Order processed
o Reasoning: Tests a valid order with successful payment.
Test Case 2:
o Input: order = valid order with failed payment
o Expected Output: Payment failed
o Reasoning: Tests a valid order with failed payment.
Test Case 3:
o Input: order = invalid order
o Expected Output: Invalid order
o Reasoning: Tests an invalid order.
These test cases aim to cover various aspects of white box and black box testing to ensure comprehensive
testing of the code. Adjustments might be needed based on the actual implementation details and requirements.