50% found this document useful (2 votes)
951 views

OOAD Lab Report - Merged

The document is a lab report submitted by Hari Rijal to the Faculty of Management at Tribhuvan University. It contains 5 chapters that discuss various UML diagrams - use case diagram, activity diagram, class diagram, sequence diagram, and mappings from design to code. The use case diagram models the interactions between actors and the library management system. It shows use cases such as searching for books, checking out/reserving books, viewing book details, and collecting late fees.

Uploaded by

Kushal Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
951 views

OOAD Lab Report - Merged

The document is a lab report submitted by Hari Rijal to the Faculty of Management at Tribhuvan University. It contains 5 chapters that discuss various UML diagrams - use case diagram, activity diagram, class diagram, sequence diagram, and mappings from design to code. The use case diagram models the interactions between actors and the library management system. It shows use cases such as searching for books, checking out/reserving books, viewing book details, and collecting late fees.

Uploaded by

Kushal Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

ASIAN SCHOOL OF MANAGEMENT

AND TECHNOLOGY
Gongabu, Kathmandu, Nepal

PREPARED BY:

Hari Rijal

Exam Roll No.: 7822/17

T.U. Registration No.: 7-2-1181-61-2017

A Object Oriented Analysis and Design Lab Report Based on UML Diagram
Submitted to

Faculty of Management, Tribhuvan University

in partial fulfillment of the requirements for the degree of

Bachelor of Information Management

Internal Examiner: External Examiner:

Name: Bikash Balami Name:

Signature: Signature

February 27, 2022


TABLE OF CONTENTS
TABLE OF CONTENTS ................................................................................................... i
ACKNOWLEDGEMENT .................................................................................................ii
LIST OF FIGURES ......................................................................................................... iii
LIST OF ABBREVIATION............................................................................................. iv
CHAPTER ONE: USE CASE DIAGRAM ..................................................................... 1
1.1 Introduction of Use Case ............................................................................................ 1
1.2 Relationship between Use Cases ................................................................................ 2
1.3 Use Case Diagram for Library Management System................................................. 3
CHAPTER TWO: ACTIVITY DIAGRAM .................................................................... 6
2.1 Introduction of Activity Diagram ............................................................................... 6
2.2 Component of Activity Diagram ................................................................................ 6
2.3 Activity Diagram of Ticket Vending Machine .......................................................... 7
2.4 Activity Diagram for Online Shopping Process ......................................................... 8
CHAPTER THREE: CLASS DIAGRAM ..................................................................... 10
3.1 Introduction of Class Diagram ................................................................................. 10
3.2 Class Relationships .................................................................................................. 10
3.3 Class Diagram Example of Movie-Shop .................................................................. 11
3.4 Class Diagram Example of Flight ............................................................................ 13
CHAPTER FOUR: SEQUENCE DIAGRAM .............................................................. 14
4.1 Introduction of Sequence Diagram .......................................................................... 14
4.2 Components of Sequence Diagram .......................................................................... 14
4.3 Sequence Diagram for Borrowing the Book from Library ...................................... 15
4.4 Sequence Diagram for Make a Phone Call .............................................................. 16
CHAPTER FIVE: MAPPINGS DESIGN TO CODE .................................................. 17
5.1 Introduction to Mapping Design to Code ................................................................. 17
5.2 Library Management system .................................................................................... 17
5.3 Billing System .......................................................................................................... 19

i
ACKNOWLEDGEMENT
This lab report has been prepared for the partial fulfilment of the requirements for the
degree of Bachelor of Information Management, prescribed by faculty of Management,
Tribhuvan University. This is an individual report assigned to me during my academic
study in BIM Seventh semester, I should remain thankful to many people for the successful
completion of this summer project.

I would like to express sincere gratitude to my faculty member, Mr. Bikash Balami, for
providing necessary guidelines for completion of this report. I am thankful to him for his
continuous reinforcement and motivation for completing this lab report successfully. I
thank for his regular feedback and suggestion to improve the report further.

We are very thankful to respected Associate Lecturer, Mr. Surya Bam for helping and
encouraging us in every aspect of my academic study. Also, I would like to thank all the
respondents who filled the questionnaire and helped me with the continuation of the report.

Finally, I would like to thank my friends for uplifting my spirit to complete the report in
time.

ii
LIST OF FIGURES
Figure 1: Usecase diagram of Library Management System...............................................3

Figure 2: Activity Diagram of Ticket Vending Machine.....................................................5

Figure 3: Activity diagram of Online Shopping Process...................................................12

Figure 4: Class Diagram of Movie Shop............................................................................14

Figure 5: Class Diagram of Flight .....................................................................................15

Figure 6: Sequence diagram of Borrowing the Book from Library ..................................16

Fig 7: Sequence diagram of make a phone call..................................................................17

iii
LIST OF ABBREVIATION
BIM Bachelor of Information Management

ID Identity

UML Unified Modeling Language

iv
CHAPTER ONE: USE CASE DIAGRAM
1.1 Introduction of Use Case

• Is a representation of a user’s interaction with the system that shows the relationship
between the user and the different use cases in which the user is involved?

• The emphasis is on what a system does rather than how

• Indicate the functional requirement of the system

Components of use case diagram

• Actors

• Use cases

• System Boundary

• Relationship

Actor

• Is someone or something outside the system that interacts with the systems

• Exchanged data with the system

• An actor can be a human or automated system

• UML notation for actor is stick man

• Primary Actor

• Acts on the system

• Initiates an interaction

• Secondary Actor

• Acted by the system

Use Case

• A set of scenarios that describes an interaction between a user and a system

• Describe the task

• Is a pattern of behavior, the system exhibits?

• Easily grasped by non-technical users

1
• Represented by oval

• How to find the use cases

• What are the system tasks for each actor defined in the system?

• What information must be modified or created in the system

System Boundary

• Rectangle diagram representing the boundary between the actors and the
system

• Helps to identify the responsibilities of the system

1.2 Relationship between Use Cases

• Include
• Extend
• Generalization

Include Relationship

– Represents the inclusion of the functionality of one-use case within another

– Insert additional behaviour into a base use case

– Dotted line with an open arrow is drawn from the base use case to the used
use case

– Write << include >> above arrowhead line

Extend Relationship

– Represents the extension of the use case to include optional functionality

– Used to indicate that use completely consists of the behaviour of another use
case at one or specific point

– Dotted line with an open arrow is drawn from the extension use case to the
base use case

– Write << extend >> above arrowhead line

Generalization

2
– Is a relationship between a general use case

and more specific use case that inherits features in it

– Shows as solid line with a hollow arrow point

1.3 Use Case Diagram for Library Management System

1. Any library member should be able to search books by their title, author, subject
category as well by the publication date.
2. Each book will have a unique identification number and other details including a
rack number which will help to physically locate the book.
3. There could be more than one copy of a book, and library members should be able
to check-out and reserve any copy. We will call each copy of a book, a book item.
4. The system should be able to retrieve information like who took particular book or
what are the books checked-out by a specific library member.
5. The system should able to collect fines for book returned after the due date.
6. Members should be able to reserve books that are not currently available.
7. The system should be able to send notifications whenever the reserved books
become available, as well as when the book is not returned within the due date.
8. Each book and member card will have a unique barcode. the system will be able to
read barcodes from books and members' library cards.
9. Librarian has a key role in this system. Librarian adds the records in the library
database about each student or user every time issuing the book or returning the
book, or paying fine.
10. Librarian also deletes the record of a particular student if the students leave the
college or passed out from the college. If the book no longer exists in the library,
then the record of the particular book is also deleted.

We have three main actors in our system:

• Librarian: Mainly responsible for adding and modifying books, book items, and
users. The Librarian can also issue, reserve, and return book items.
• Members: All members can search the catalog, as well as check-out, reserve,
renew, and return a book.
• System: Mainly responsible for sending notifications for overdue books, canceled
reservations, etc.

3
Here are the top use cases of the Library Management System:

• Add/Remove/Edit book: To add, remove or modify a book or book item.


• Search catalog: To search books by title, author, subject or publication date.
• Register new account/cancel membership: To add a new member or cancel the
membership of an existing member.
• Check-out book: To borrow a book from the library.
• Reserve book: To reserve a book which is not currently available.
• Renew a book: To reborrow an already checked-out book.
• Return a book: To return a book to the library which was issued to a member.

4
Fig 1: Usecase diagram of Library Management System

5
CHAPTER TWO: ACTIVITY DIAGRAM
2.1 Introduction of Activity Diagram

• Activity diagram is basically a flow chart to represent the flow form one activity to
another activity

• The control flow is drawn from one operation to another and this flow can be
sequential, branched or concurrent

• This flow can be sequential, branched, or concurrent

• Describe the dynamic aspects of the system

• Specify system behavior

2.2 Component of Activity Diagram

• Activity

o Is some tasks which needs to be done Activity

o Represented by rounded rectangle

• Transmission (Flow)

o When the activity of a state completes, flow of control passes to the next
action

o Represented by arrow symbol

• Starting Node

o The source of flow of control

o Represented by marked circle

• Ending Node

o Destination of flow of control

o Represented by marked circle in a circle

• Join

– Join and Fork have the same notation (either a horizontal or vertical bar)

6
– A black bar with several flows entering in it and one leaving from it

– Denoted the end of parallel activities

• Fork

– Beginning of the parallel activities

• Decision

– A diamond with one flow entering and several leaving

– The flow leaving includes conditions as TRUE/FALSE state

• Merge

– A diamond with several flows entering and one leaving

– The implication is that all incoming flows to reach this point until processing
continues

• Notes

– Used to add relevant comments to elements

2.3 Activity Diagram of Ticket Vending Machine

o Activity is started by commuter actor who needs to buy a ticket. Ticket vending
machine will request trip information form Commuter. This information will
include number and type of ticket, e.g., whether it is a monthly pass, one way or
round ticket, route number, destination number.
o Based on this information, ticket vending machine will calculate payment due and
request payment option (Cash, Card).
o If card, Bank will participate in this activity.

7
Fig 2: Activity Diagram of Ticket Vending Machine

2.4 Activity Diagram for Online Shopping Process

– Online customer can browse or search items, view specific item, add it to the
shopping cart, view and update the shopping cart, checkout.
– User can view shopping cart at any time.
– Checkout is assumed to include user registration and login.

8
Fig 3: Activity diagram of Online Shopping Process

9
CHAPTER THREE: CLASS DIAGRAM
3.1 Introduction of Class Diagram

• A class is a description of a set of objects that share the same attributes, operations,
relationships, and semantics

• A class diagram is a diagram describing the structure of a system

• Shows the system’s

– Classes

– Attributes

– Methods

– Relationship among classes

3.2 Class Relationships

• In UML, object interconnections (logical or physical), are modeled as relationships

• Types

– Dependencies

– Generalization

– Associations

• Dependencies Relationship: The dependency from CourseSchedule to Course


exists because Course is used in both the add and remove operations of
CourseSchedule

• Generalization Relationship: A generalization connects a subclass to its


superclass.
It denotes an inheritance of attributes and behavior from the superclass to the
subclass and indicates a specialization in the subclass of the more general
superclass.

10
• Association Relationship: If two classes in a model need to communicate with
each other, there must be link between them. An association denotes that link.

3.3 Class Diagram Example of Movie-Shop

– Design a class diagram for a movie – shop, in order to handle ordering of


movies and browsing of the catalogue of the store and user subscriptions
with rechargeable card
– Only subscribers are allowed hiring movies with their own card
– Credit is updated on the card during rent operations
– Both users and subscribers can buy a movie and their data is saved in the
related order
– When a movie is not available, it is ordered
– Hints: User, Subscriber, Card, Movie, Movie_Shop, Order, Movie_Rent,
Movie_Buy

11
Fig 4: Class Diagram of Movie Shop

12
3.4 Class Diagram Example of Flight

– Model a system management of flights and pilots


– An airline operates flight. Each airline has an ID
– Each flight has an ID a departure airport and an arrival airport:
– an airport as a unique identifier.
– Each flight has a pilot and a co-pilot, and it uses an aircraft of a certain type;
a flight has also a departure time and an arrival time.
– An airline owns a set of aircrafts of different types
– An aircraft can be in a working state or it can be under repair.
– In a particular moment an aircraft can be landed or airborne.
– A company has a set of pilots: each pilot has an experience level: 1 id
minimum, 3 is maximum.
– A type of airplane may need a particular number of pilots, with a different
role (e.g.; captain, co-pilot, navigator): there must be at least one captain
and one co-pilot, and a captain must have a level 3

Fig 5: Class Diagram of Flight

13
CHAPTER FOUR: SEQUENCE DIAGRAM
4.1 Introduction of Sequence Diagram

• Describe the flow of messages, events, actions between objects

• Show concurrent processes and activations

• Show time sequences that are not easily depicted in other diagrams

• Shows system events for a scenario of a use case, therefore it is generated from
inspection of a use case

• Participant: - an object or entity that acts in the sequence diagram

• Message: - communication between participant objects

• Axes in sequence diagram: -

• horizontal: which object/participant is acting

• vertical: time (down -> forward in time), Lower = Later

4.2 Components of Sequence Diagram

• Lifeline

– The Life-Line represents the object’s life during the interaction

– Represented by dashed vertical line

• Activation

– Thick box over object's life line; drawn when object's method is on the stack

14
• Message
– Optionally indicated using a dashed arrow with a label indicating the return
value
– Different arrowheads for normal/ concurrent (asynchronous) methods

– Synchronous Message: Synchronous message requires a response


before the interaction can continue.
– Asynchronous Message: Asynchronous message don't need replay for
interaction to continue.

4.3 Sequence Diagram for Borrowing the Book from Library

Example: Design a sequence diagram for the function "Borrowing the Book" in Library
Management System.

Fig 6: Sequence diagram of Borrowing the Book from Library


15
4.4 Sequence Diagram for Make a Phone Call

Example: Design a sequence diagram for the function “make a phone call”.

Fig 7: Sequence diagram of make a phone call

16
CHAPTER FIVE: MAPPINGS DESIGN TO CODE
5.1 Introduction to Mapping Design to Code

Implementation in an object-oriented language requires writing source code for:

• Class and interface definition


• Method definition

Design Class Diagrams contain class or interface names, classes, method and
simple attributes. These are sufficient for basic class definitions. Elaborate from
associations to add reference attributes.

Example: Draw the class diagram with relation and convert to design to code

5.2 Library Management system

Book(id, name, author_name, published_date, isbn)

Student(roll, name, class)

Librarian (id, name, contact)

Assumptions:

1. One student can borrow at most 2 books


2. Librarian enters the information about book and student

//Lab.java

import java.util.Map;

class Book {

int id;

String name, author_name;

Date published_date;

String isbn;

17
Map getBookDetails() {}

class Student {

int roll;

String name, className;

int checkBorrowHistory() {}

Class Librarian {

int id;

String name, contact;

void enterBookDetails(Book(id, name, author_name, published_date, isbn))


{}

void enterStudentDetails(Student(roll, name, classname)) {}

class Book {}

18
5.3 Billing System

//Bill.java

public class Bill {

private String billno;


public Mobile mobile_number;
private String amount;

public void set(String billno, Mobile mobile_number, String amount) {


// TODO - implement Bill.set
this.billno=billno;
this.mobile_number = mobile_number;
this.amount = amount;
}

public void display() {


// TODO - implement Bill.display
System.out.println("Billno:"+billno);
System.out.println("mobile:"+mobile_number.number);
}
}

public class Mobile {

public String number;


private String brand;

/**
*
* @param number
* @param brand
*/
public void set(String number, String brand) {
// TODO - implement Mobile.set
this.number = number;
this.brand = brand;
}

public void display() {


// TODO - implement Mobile.display
System.out.println("Number:"+number);
System.out.println("Brand:"+brand);
}

}
public class Person {

19
public String name;
public String id;

/**
*
* @param id
* @param name
*/
public void setPerson(String id, String name) {
// TODO - implement Person.setPerson
this.id = id;
this.name = name;
}

public void display() {


// TODO - implement Person.display
System.out.println("Name::"+name);
System.out.println("id:"+id);
}

}
public class BillDemo {
public static void main(String[] args) {

Person p1 = new Person();


p1.setPerson("1", "Ravi");

Person p2 = new Person();


p2.setPerson("1", "Tamang");

p1.display();
p2.display();

Mobile m1 = new Mobile();


m1.set("9808079111", "apple");

Bill b1 = new Bill();


b1.set("1", m1, "500");

b1.display();

20

You might also like