KEMBAR78
Ooad QB Answers | PDF | Unified Modeling Language | Use Case
0% found this document useful (0 votes)
77 views46 pages

Ooad QB Answers

The document provides a comprehensive question bank on Object Oriented Design and Analysis, covering key concepts such as object definition, encapsulation, inheritance, aggregation, and various UML diagrams. It includes definitions, comparisons, and classifications relevant to software engineering methodologies and practices. Additionally, it discusses the software development process, including the Waterfall Model, and presents approaches for identifying classes and relationships in object-oriented design.

Uploaded by

likithasiri3
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
0% found this document useful (0 votes)
77 views46 pages

Ooad QB Answers

The document provides a comprehensive question bank on Object Oriented Design and Analysis, covering key concepts such as object definition, encapsulation, inheritance, aggregation, and various UML diagrams. It includes definitions, comparisons, and classifications relevant to software engineering methodologies and practices. Additionally, it discusses the software development process, including the Waterfall Model, and presents approaches for identifying classes and relationships in object-oriented design.

Uploaded by

likithasiri3
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/ 46

Object Oriented Design and Analysis

Question Bank Answers


Part-A [Module-1]:
1. Define object.
Ans: It is a real-world entity that has properties and methods. An
object may have a physical existence (tangible), like a customer, a
car, etc. or an (intangible) conceptual existence, like a project, a
process, etc.
2. Compare encapsulation and information hiding.
Ans: Encapsulation: Encapsulation is the process of binding both
attributes and methods together within a class. Through
encapsulation, the internal details of a class can be hidden from
outside.
Information Hiding / Data Hiding: Typically, a class is designed such
that its data (attributes) can be accessed only by its class methods
and insulated from direct outside access. This process of
insulating an object’s data is called data hiding or information
hiding.

3. Define inheritance.
Ans: Inheritance is the mechanism that permits new classes to be
created out of existing classes by extending and refining its
capabilities. The existing classes are called the base
classes/parent classes/super-classes, and the new classes are
called the derived classes/child classes/subclasses.

4. Define aggregation.
Ans: Aggregation or composition is a relationship among classes
by which a class can be made up of any combination of objects of
other classes. It allows objects to be placed directly within the
body of other classes.

5. Define correctness and correspondence.


Ans: Correspondence measures how well delivered system
matches needs of operational environment, as described in
original requirements statement
Correctness measures consistency of product requirements with
respect to design specification

6. Define Verification and Validation.


Ans: Validation task of predicting correspondence (true correspondence
only determined after system is in place)
Verification Exercise of determining correctness (correctness
objective => always possible to determine if product precisely
satisfies requirements of specification)

7. Define Polymorphism.
Ans: Polymorphism is originally a Greek word that means the
ability to take multiple forms. Polymorphism allows objects with
different internal structures to have a common external interface.
Polymorphism is particularly effective while implementing
inheritance.

8. Define Object Oriented Methodology.


Ans: It is a new system development approach, encouraging and
facilitating re-use of software components. It employs
international standard Unified Modeling Language (UML) from
the Object Management Group (OMG).

9. List the four phases of Rumbaugh Object Modeling


Techniques.
Ans:
 Analysis: The results are objects and dynamic and
functional models.
 System design: The results are a structure of the basic
architecture of the system along with high-level strategy
decisions.
 Object design: This phase produces a design document,
consisting of detailed objects static, dynamic, and functional
models.
 Implementation: This activity produces reusable,
extendible, and robust code.

10. List the four primary symbol used in DFD.


Ans:

11. Define OOSE and OOBE.


Ans: Object Oriented Software Engineering
• Also called Objectory.
• Objectory is built around several different models :-
1. Use case model  Defines the inside(use case) &
outside(actors) of the system
2. Domain object model  Objects of “real world” are
mapped into domain object
3. Analysis object model  how source code should be
carried out & written
4. Implementation model  represent the implementation
of the system
5. Test Model  constitute test plan, specification & report
Object Oriented Business Engineering
• Object Modeling at the enterprise level
• Use Case serves as central vehicle for modeling, providing
traceability throughout the software engineering process.
• includes the following phases :-
• Analysis phase
• Design and Implementation phase
• Testing phase

12. Name five Booch diagrams.


Ans:
 Class diagrams
 Object diagrams
 State transition diagrams
 Module diagrams
 Process diagrams
 Interaction diagrams

13. List out the steps involved in micro development


process of Booch OMT.
Ans:
 The micro development process is a description of the day-to-
day activities.
 Steps involved:
o Identify classes and objects
o Identify classes and object semantics
o Identify classes and object relationships
o Identify classes and object interfaces and implementation

14. List out the relationship used in use case diagram.


Ans:
 Extends – used when you have one use case similar to another
use case but does a bit more (Extends the functionality of
original use case---sub class).
 Uses – Reuses the common behavior in different use case.

15. Compare static with dynamic model.


Ans:
Static model
• snapshot of a system’s parameters at rest
• represent the static aspect of a system
• Absence of change in data over time
• Example: Class diagram
Dynamic model
 Behaviour of a system over time
 Dynamic relationships show how the business objects interact
to perform tasks.
 Example: Interaction diagram

16. Define UML.


Ans: UML → “Unified Modeling Language”
 It is a industry-standard graphical language for specifying,
visualizing, constructing, and documenting the artifacts of
software systems
 “ UML is a graphical language with set of rules and
semantics”

17. Classify the types of UML diagram.


Ans:
 Use Case Diagram
 Class Diagram (static)
 Behavior diagram (dynamic)
o Interaction diagram
 Sequence Diagram
 Collaboration diagram
o State chart diagram
o Activity diagram
 Implementation Diagram
o Component Diagram
o Deployment Diagram

Part-A [Module-2]:
1. Define Classification.
Ans: Classification is the process of checking to see if an object
belongs to a category or a class and it is regarded as a basic
attribute of human nature.A class is a specification structure,
behaviour, and the description of an object.

2. Define concept class and event class.


Ans:
Events:
There are points in time that must be recorded and remembered.
• Associated with things remembered are attributes such as who,
what, when, where, how, or why.
• Things happen, usually to do something else, at a given date and
time, or as step in an ordered in an sequence.
• For example : landing, order, request
• Order placed time which is an event must be remembered
Concepts:
These are principles or ideas not tangible but used to organize or
keep Track Of Business activities and /or communications
Ex: performance

3. Compare Organization and People class.


Ans:
Organization class: specify collection of people, resources,
facilities or groups to which the user belongs, and their
capabilities have a defined mission, whose existence is largely
independent of individuals.
• For example accounting department might be considered as a
potential class.
• human resources department
Peoples Class: The Different roles users play in interacting with
the applications
 For example client, Employee , Teacher, Manager

4. Define Tangible things and device classes.


Ans: Physical Objects, or group of objects, that are Tangible, and
Devices with which the devices with Which the application
interacts. For example cars, pressure sensors

5. List out the various approaches for identifying classes.


Ans:
 The noun phrase approach.
 The common class patterns approach.
 The use-case driven approach.
 Class, Responsibilities and Collaborators (CRC)

6. Define associations.
Ans: A reference from one class to another is an association.
Basically a dependency between two or more classes is an
association. For example, Jackie works for John.

7. Classify object relationships.


Ans: Three types of relationships among objects are:
 Association.
 Super-sub structure (also known as generalization
hierarchy).
 Aggregation and a-part-of structure
8. Define super–sub class relationships.
Ans: Sub-classes are more specialized versions of their super-
classes

9. Define aggregation.
Ans: • A-part-of relationship, also called aggregation, represents
the situation where a class consists of several component classes.

10. Classify the properties of a part of relationships.


Ans:
Transitivity
• If A is part of B and B is part of C, then A is part of C.
• For example, a carburetor is part of an engine and an engine is
part of a car; therefore, a carburetor is part of a car.
Antisymmetry
• If A is part of B, then B is not part of A.
• For example, an engine is part of a car, but a car is not part of
an engine.
11. Define use case diagram.
Ans: A Use Case is a sequence of transactions in a system whose
task is to yield results of measurable value to an individual actor
of the system.

12. Define Class diagram.


Ans:
 The UML class diagram is the main static analysis diagram.
• Class diagrams show the static structure of the model.
• Class diagram is collection of static modeling elements, such as
classes and their relationships.

13. Describe why analysis is a difficult activity ?


Ans: Analysis is a creative process, that involves understanding
problem domain, its associated constraints, and methods to
overcome those constraints
Three most common sources of requirements difficulties :-
 Fuzzy Description
 Incomplete Requirements
 Unnecessary Features
Part-B [Module-1]:
1. Explain the various types of inheritance with appropriate
examples.
Ans:
• Single Inheritance − A subclass derives from a single super-
class.
• Multiple Inheritance − A subclass derives from more than one
super-classes.
• Multilevel Inheritance − A subclass derives from a super-
class which in turn is derived from another class and so on.
• Hierarchical Inheritance − A class has a number of subclasses
each of which may have subsequent subclasses, continuing for
a number of levels, so as to form a tree structure.
• Hybrid Inheritance − A combination of multiple and
multilevel inheritance so as to form a lattice structure.
2. Imagine you are tasked with designing an Automated
Teller Machine (ATM) system. For the examination, please
sketch the state transition diagram for this ATM system.
Your diagram should clearly represent the different states
of the ATM and the transitions between them.
Additionally, label the states and transitions to provide a
comprehensive understanding of how this system
functions.
Ans: State Diagram:- State transition diagrams provide a way to
model the various states in
which an object can exist. While the class diagram shows a static
picture of the classes and
their relationships, state transition diagrams model the dynamic
behavior of a system in
response to external events (stimuli). State transition diagrams
consist of the following:
1. States, which show the possible situations in which an object
can find itself
2. Transitions, which show the different events which cause a
change in the state of an object.
1 State A state is an abstraction of the values and
State
links of an object. State models a situation
during which some (usually implicit) invariant
condition holds.
2 Transition A transition is a directed relationship
between a source state and a target state. It
may be part of a compound transition, which
takes the state machine from one state
configuration to another
3 Event A transition is an instantaneous change from
Event
one to another state
4 Initial state It shows the starting state of object.
point

5 Final state It shows the terminating state of object.


point

The State Diagram for the session of ATM

3. As part of your software engineering assignment, consider


that you are developing a complex alarm system for a
home security application. To assess your grasp of state
transition diagrams in Booch notation, sketch an alarm
class state transition diagram for this system. Ensure that
your diagram effectively illustrates the various states of
the alarm and the transitions between them, using Booch
notation to represent this crucial aspect of the software
design.
Ans: (Write the same answer of Question no 2 for Theory with
Little more explanation about the an Alarm lke how it works etc)
4. Describe software development process in brief. Explain it
with an example.
Ans: Software development process-Waterfall Model

Phases of Waterfall Model:


 Requirements Gathering and Analysis: The first phase
involves gathering requirements from stakeholders and
analyzing them to understand the scope and objectives of the
project.
 Design: Once the requirements are understood, the design
phase begins. This involves creating a detailed design
document that outlines the software architecture, user
interface, and system components.
 Implementation: The implementation phase involves coding
the software based on the design specifications. This phase
also includes unit testing to ensure that each component of the
software is working as expected.
 Testing: In the testing phase, the software is tested as a whole
to ensure that it meets the requirements and is free from
defects.
 Deployment: Once the software has been tested and
approved, it is deployed to the production environment.
 Maintenance: The final phase of the Waterfall Model is
maintenance, which involves fixing any issues that arise after
the software has been deployed and ensuring that it continues
to meet the requirements over time.
Advantages of the waterfall model
• Easy to Understand
• Properly Defined
• Properly Documented
• Individual Processing
• Works well for smaller projects
Disadvantages of the Waterfall Model
• No Overlapping of Phases
• Limited Flexibility
• Not Suitable for Complex Projects
5. As part of a critical phase in the development of an ATM
system, your team has been tasked with creating a
comprehensive data flow diagram using Object Modeling
Technique (OMT). To demonstrate your understanding of
OMT and your ability to depict data flow within the
system, sketch the OMT data flow diagram for the ATM
system. Your diagram should clearly illustrate how
information is processed and transferred within the ATM
system.
Ans:
• Data Flow Diagram shows the flow of data between different
processes in a business.
• OMT DFD provides simple and intuitive approach for
describing business processes.

(Also Explain a bit of Diagram like what are all the processes,
how an ATM Machine Works and much more)
Part-B [Module-2]:
1. A store wants to automate its inventory. It has point-of-
sale terminals that can record all of the items and
quantities that a customer purchases. Another terminal is
also available for the customer service desk to handle
returns. It has a similar terminal in the loading dock to
handle arriving shipments from suppliers. The meat
department and produce department have terminals to
enter losses/discounts due to spoilage. Choose Noun
phrase approach for identifying the objects from the
grocery store problem.
Ans:
 Identifying Tentative Classes
 Selecting Classes from the relevant and Fuzzy Categories
 Identifying Classes
 Initial List of Noun Phrases: Candidate Classes
 Reviewing the redundant Classes and Building a Common
Vocabulary
 Reviewing the Classes Containing Adjectives
 Reviewing the Possible Attributes
 Reviewing the Class Purpose
Apply noun phrase approach for Grocery store problem
Step.1: Identify nouns
• Store
• Inventory
• Point-of-sale terminal
• Terminals
• Items
• Quantity
• Purchase
• Customer
• Customer service desk
• Handle returns
• Returns
• Loading dock
• Shipment
• Handle shipment
• Suppliers
• Meat department
• Produce department
• Department
• Enter losses
• Enter discount
• Spoilage
Step.2: Eliminate irrelevant nouns
• Store
• Point-of-sale terminal
• inventory
• Item
• Customer
• Customer service desk
• Handle returns
• Returns
• Handle shipment
• Shipment
• Enter losses
• Enter discount
• Meat department
• Produce department
• Department
Step.3 Eliminate redundancies
• Store
• Point-of-sale terminal
• Item
• Customer service desk
• Handle returns
• Handle shipment
• Meat department
• Produce department
• Enter losses
• Enter discount

2. Explain with an appropriate example for various common


class pattern approach and a-part-of relationship. Classify
the properties of a-part-of relationship.
Ans:
Common Class Pattern Approach:
 This approach is based on the knowledge – base of the
common classes that have been proposed by the various
researchers.
 It was proposed by Shaler &Mellor, Ross, and Coad &
Yourdon
Patterns for finding the candidate class and objects
 Concept Class [Idea or Understanding]
 Event Class [points in time to be recorded]
 Organization Class [collection of people, resources, groups]
 People Class [roles user play to interact with the system]
 Places Class [physical locations the system has info about]
 Tangible things and devices [physical objects]

A-part-of relationship
A-part-of relationship, also called aggregation, represents the
situation where a class consists of several component classes.
Transitivity
• If A is part of B and B is part of C, then A is part of C.
• For example, a carburetor is part of an engine and an engine is
part of a car; therefore, a carburetor is part of a car.
Antisymmetry
• If A is part of B, then B is not part of A.
• For example, an engine is part of a car, but a car is not part of
an engine.

3. Explain use case model in detail. Describe uses and


extends associations with appropriate example.
Ans:
• A picture describes how actors relate to use cases and use cases
relate to one another
• Diagrams are not essential
• They are helpful in giving an overview, but only secondary in
importance to the textual description
• They do not capture the full information of the actual use cases
• In contrast, text is essential
Extends
• Extend relationship – linking an optional use case to a standard
use case.
• Example: Register Course (standard use case) may have
Register for Special Class (extend use case) – class for non-standard
students, in unusual time, with special topics, requiring extra fees…)

4. In your current project, you are developing two critical


systems: a Library Management System and a Hospital
Management System. To evaluate your understanding of
use case diagrams and your ability to represent system
functionality, sketch separate use case diagrams for both
systems. Ensure that your diagrams clearly depict the
actors, use cases, and the interactions between them for
the Library Management System and the Hospital
Management System.
Ans:
Hospital Management System:

5. Describe the guidelines for identifying association and


super subclass relationship with necessary examples.
Ans: Sub-classes are more specialized versions of their super-
classes
Part-C [Module-1]:
1. Illustrate object oriented software development life cycle
with neat sketch.
Ans: Software Development Life Cycle (SDLC)
• it is a process used by the software industry to design, develop
and test high quality software.
• The SDLC aims to produce a high-quality software that meets
or exceeds customer expectations, reaches completion within
times and cost estimates.
• SDLC is a framework defining tasks performed at each step
in the software development process.
Software Development Life Cycle (SDLC) Phases
• Transformation 1(analysis) - translates user’s need into
system’s requirements & responsibilities.
• Transformation 2 (design) - begins with problem statement,
ends with detailed design that can be transformed into
operational system.
• Transformation 3 (implementation) - refines detailed
design into system deployment that will satisfy user’s needs.
SDLC Models:
• Waterfall Model
• Iterative Model
• Spiral Model
• V-Model
• Big Bang Model
2. Describe Rambaugh Object Model and Booch methodology
with appropriate examples.
Ans: Rumbaugh et al.’s Object Modeling Techniques (OMT)
• It was one of the first object oriented methodologies and was
introduced by Rumbaugh in 1991.
• A method for analysis, design and implementation by an object
oriented technique.
• Fast and intuitive approach for identifying and modeling all
objects making up a system.
• Class attributes, methods, inheritance and association can be
expressed easily.
• Dynamic behavior of objects can be described using the OMT
dynamic model.
• Detailed specification of state transitions and their
descriptions within a system.
OMT consists of four phases, which can be performed iteratively:
• Analysis: The results are objects and dynamic and functional
models.
• System design: The results are a structure of the basic
architecture of the system along with high-level strategy
decisions.
• Object design: This phase produces a design document,
consisting of detailed objects static, dynamic, and functional
models.
• Implementation: This activity produces reusable, extendible,
and robust code.
OMT separates modeling into three different parts:
• An Object model
• A Dynamic model
• A Functional model
The Object Model
• It depicts the object classes and their relationships as a class
diagram, which represents the static structure of the system.
• The object model is represented graphically with an object
diagram
• The object diagram contains classes interconnected by
association lines.
• Each class represents a set of individual objects.
• The association lines establish relationships among the classes.
• Each association line represents a set of links from the objects
of one class to the objects of another class.

The OMT Dynamic Model


• OMT provides a detailed and comprehensive dynamic model,
in addition to letting you depict states, transitions, events, and
actions.
• The OMT state transition diagram is a network of states and
events.
• Each state receives one or more events, at which time it makes
the transition to the next state.
• The next state depends on the current state as well as the
events.

The OMT Functional Model


 Data Flow Diagram shows the flow of data between different
processes in a business.
 OMT DFD provides simple and intuitive approach for
describing business processes.
 Four Primary Symbols used in DFD are :-
o Process ->The process is any function being performed; for
example, verify Password or PIN in the ATM system
o Data flow -> The data flow shows the direction of data element
movement; for example, PIN code.
o Data store -> The data store is a location where data are
stored; for example, account is a data store in the ATM
example.
o External entity -> An external entity is a source or destination
of a data element; for example, the ATM card reader.

Booch Methodology
• The Booch method is one well-known OO-method
• Design the systems using the object paradigm
• Covers the analysis and design phases of an OO-system
implementation
• Booch defines a lot of symbols to document almost every
design decision
• This method starts with class and object diagrams (a
discovering activity) in the analysis phase
• These diagrams to be refined through various steps
• Refinement process continues till the problem domain gets
more and more understood following an evolutionary approach
• Design symbols are to be added when ready to generate code
• Usually it represents very final implementation decisions
• Booch notation are larger sets and appears to prove beneficial:
it is possible to fully document the OO-code
Booch proposes different views to describe an OO system
o Physical model
o Logical model
o Static model
o Dynamic model
The Booch method consists of the following diagrams
 Class diagrams  a set of objects that share the same
attributes, operations & relationships.

 Object diagrams 
 State transition diagrams Shows the dynamic behavior of
classes

 Module diagrams Module diagrams are used to show the


allocation of classes and objects to modules in the physical
design of a system
 Process diagrams A process diagram is used to show the
allocation of processes to processors in a physical design of a
system
 Interaction diagrams  Interaction diagrams trace the
execution of a scenario in the same context as an object
diagram

3. Illustrate Jacobson Methodology with appropriate


examples in detail.
Ans:
• OOSE is developed by Ivar Jacobson in 1992. OOSE is the first
object-oriented design methodology that employs use cases in
software design.
• It covers entire life cycle and stress traceability between
different phases
• Advantage :-
• Reduction of development time
• Reuse of code
• Reuse of analysis and design work
• Use-Case is an interaction between user and the system.
• Scenarios for understanding system requirements.
• Use-case model captures the goal of the user and the
responsibility of the system to its users.

4. Describe the process and components of unified approach


with neat sketch.
Ans:
• Unified Approach “establishes a unifying framework by
utilizing the UML diagram to describe, model and document
the software development process”.
• Motivation :-
• Combine best practices, methodologies, processes and
guidelines along with UML diagrams for better
understanding of OOPS concept & System development
Processes involved in Unified Approach
• Use-case driven development
• OO Analysis
o Analysis is the process of extracting the needs of a system and
what the system must do to satisfy the users’ requirements.
o The goal of object-oriented analysis is to first understand the
domain of the problem and the system’s responsibilities by
understanding how the users use or will use the system.
o OOA process consists of the following steps:
• Identify the Actors.
• Develop a simple business process model using UML Activity
diagram.
• Develop the Use Case.
• Develop interaction diagrams.
• Identify classes.

• OO design
o Booch, provides the most comprehensive object-oriented
design method.
o Rumbaugh et al.‘s and Jacobson et al.’s high-level models
provide good avenues for getting started.
o UA combines these by utilizing Jacobson et al.’s analysis and
interaction diagrams, Booch’s object diagrams, and Rumbaugh
et al.’s domain models.
o OOD Process consists of:
• Designing classes, their attributes, methods, associations,
structures and protocols, apply design axioms.
• Design the Access Layer
• Design and prototype User interface
• User Satisfaction and Usability Tests based on the Usage/Use
Cases
• Iterated and refine the design

• Incremental Development and Prototyping


• Continuous Testing
Part-C [Module-2]:
1. When the customer inserts the bank or credit card in the
ATM’s card reader, the entry action i.e read card is
performed by the ATM machine. If the card is not valid
then the machine will perform exit action. After the card is
being read successfully, the ATM machine will ask for Pin.
Then the customer enters the pin and ATM machine then
reads pin. If the pin entered is not valid then machine will
perform exit action. If the pin entered is valid, then the
machine further process towards transaction. After
successful transaction, machine undergoes the exit action
i.e., eject card that discharges the customer’s card. Sketch
the use case diagram and class diagram for the above
given scenario.
Ans:
Use Case Diagram: Use case diagrams describe the functionality
of a system and users
of the system. They contain the following elements:
1. Actors, which represent users of a system, including human
users and other systems
2. Use cases, which represent functionality or services provided
by a system to users
Here, is a use case diagram for the ATM System

Class Diagram:- Class diagrams describe the static structure of a


system, or how it is
structured rather than how it behaves.
These diagrams contain the following elements:
1. Classes, which represent entities with common characteristics
or features. These
features include attributes, operations, and associations.
2. Associations, which represent relationships that relate two or
more other classes where
the relationships have common characteristics or features. These
features include attributes and
operations
Check Exceeding
Balance

Log Out

Depit Card Login Credit Card Login

2. Describe use case driven approach for identifying classes


and CRC card with appropriate example.
Ans: IDENTIFYING CLASSES AND THEIR BEHAVIORS
THROUGH SEQUENCE/COLLABORATION MODELING
• The use cases are employed to model the scenarios in the
system and
specify what external actors interact with the scenarios.
• The scenarios are described in text or through a sequence of
steps
• The process of creating sequence or collaboration diagrams is a
systematic
way to think about how a use case (scenario) can take place; and
by
doing so, it forces you to think about objects involved in your
application
CASE STUDY: THE VIANET BANK ATM SYSTEM: DECOMPOSING
• To identify objects of a system, we further analyze the lowest
level use cases with a sequence and collaboration diagram pair
• We identified the use cases for the bank system.
• The following are the low level (executable) use cases:
• Deposit Checking
• Deposit Savings
• Invalid PIN
• Withdraw Checking
• Withdraw More from Checking
• Withdraw Savings
• Checking Transaction History
• Savings Transaction History
• Withdraw Savings Denied
Class, Responsibilities and Collaborators (CRC)
• Classes, Responsibilities, and Collaborators is a technique used
for identifying classes, responsibilities and therefore their attributes
and methods.
• Classes, Responsibilities, and Collaborators is based on the idea
that an object either can accomplish a certain responsibility itself or
it may require the assistance of other objects.
• If it requires the assistance of other objects, it must collaborate
with those objects to fulfill its responsibility
• Classes, Responsibilities, and Collaborators cards are 4" x 6"
index cards.
• All the information for an object is written on a card, which is
cheap, portable, readily
available, and familiar
• The class name should appear in the upper left-hand corner, a
bulleted list of responsibilities should appear under it in the left two
thirds of the card, and the list of collaborators should appear in the
right third.

3. Imagine you are tasked with designing a sequence


diagram and a collaboration diagram for the 'Withdraw
Checking' use case in an ATM. To assess your proficiency
in both sequence and collaboration diagram modeling,
create separate diagrams to illustrate the interactions
between the objects involved in this use case. Your
diagrams should provide a clear representation of the
steps and interactions as a Bank client withdraws money
from their checking account.
Ans:
Sequence Diagram:
A sequence diagram is a type of interaction diagram because it
describes how—and in what order—a group of objects works
together. Sequence diagrams typically show the flow of
functionality through a use case, and consist of the following
components:
o Actors, involved in the functionality
o Object, that a system needs to provide the functionality
o Messages, which represent communication between
objects
Here, is an example of Sequence diagram for withdrawing amount
from ATM.
Collaboration Diagrams
A Communication or Collaboration diagram, as shown is a
directed graph that uses objects and actors as graph nodes. The
focus of the collaboration diagram is on the roles of the objects as
they interact to realize a system function. Directional links are
used to indicate communication between objects. These links are
labeled using appropriate messages. Each message is prefixed
with a sequence number indicating the time ordering needed to
realize the system function.

Here is an example of the Check Balance communication diagram:

Here is an example of the Deposit Cash communication diagram:


4. "The Railway Reservation system contain the following
features:
If a passenger wants to reserve ticket(s), firstly, he/she
has to log in to the Railway system with valid credentials.
Then, the passenger has to provide his/her details with
the date of the journey, names of the passengers and their
details, origin station details, destination station details,
and the class type of the required ticket(s).
The Railway Reservation System will provide the available
Train-list, and Seat-availability, via-details.
To book a ticket passengers can pay through
online/offline mode. After successful payment of the ticket
fare the System will generate the ticket and PNR no. will be
given to the passenger. The System also keeps the
payment details and sends them to the system Admin.
The Passenger can check PNR status (confirmed, RAC,
waiting list) by entering the PNR no. into the Reservation
system.
The Reservation system should store all train details, fare
details (by zone, class, and date wise), PNR no, date of
trains, etc. This maintenance should be controlled by the
Admin.
The System also has refund rules which have a date of
reservation, ticket fare, and refundable percentage. The
passenger can simply cancel the ticket(s) by entering the
PNR no and a cancel ticket request. After cancelation, the
Admin will pass the refundable amount to the System and
the System will give the refundable amount to the
passenger. Sketch the usecase diagram and class diagram
for the above given scenario."
Ans: Railway Ticket Reservation System
The Reservation system should contain the following features:
• If a passenger wants to reserve ticket(s), firstly, he/she has to
log in to the Railway system with valid credentials. Then, the
passenger has to provide his/her details with the date of the
journey, names of the passengers and their details, origin station
details, destination station details, and the class type of the
required ticket(s).
• The Railway Reservation System will provide the available
Train-list, and Seat-availability, via- details.
• To book a ticket passengers can pay through online/offline
mode. After successful payment of the ticket fare the System will
generate the ticket and PNR no. will be given to the passenger.
The System also keeps the payment details and sends them to the
system Admin.
• The Passenger can check PNR status (confirmed, RAC, waiting
list) by entering the PNR no. into the Reservation system.
• The Reservation system should store all train details, fare
details (by zone, class, and date wise), PNR no, date of trains, etc.
This maintenance should be controlled by the Admin.
• The System also has refund rules which have a date of
reservation, ticket fare, and refundable percentage. The
passenger can simply cancel the ticket(s) by entering the PNR no
and a cancel ticket request. After cancelation, the Admin will pass
the refundable amount to the System and the System will give the
refundable amount to the passenger.

Class Diagram:
These diagrams describe the operation and attributes of a class
with imposed constraints in the system.
The classes to be considered are ‘payment’, ‘train’, ‘passenger’,
‘ticket’, ‘railway reservation system’, ‘admin’. The description of
the classes is given below.
Class Attributes Processes
Payment amount ticketGeneration
Train train code, train name, frequency —
login, search Train, modify the
Passenger PAX_id, name,age,sex form, pay charges, book tickets
now ticket, cancel tickets
PNR_no, status, payment type,
Ticket train code search train, date of new Ticket, delete tickets
journey
Railway
reservation system response
system
formDetails, cancellationForm,
Admin ID, name
refundAmt

Payment
+amount
-ticketGeneration()
l
+M a kes
l
Passenger Railway
+tUses Reservation
+name System
Train *Travels +age +SystemID
+ traincode I - 0 J -response
+trainN ame -log in()
T + frequency -searchtrainf)
-mod ifyForm()
+V\/OFk'2
-payCharges()
-bookTicket()
-cancleticket()
l
, +Books
Admin
l +lD
Ticket +Narne
-form Details(j
•PNRna -CancellationForm()
•status -refundAmt()
•payment type
-trainCode
-dateOCourney
-newticket()
-dele teticket()
Use-Case Diagram:
By using use case diagrams, the interactions between a system
and the users within that system will be represented.
The relationship between the actors and the use cases of the
online Railway reservation system is given below:
• Passenger Entity: Use cases of passengers are login, ticket
availability, Filling the form, Book ticket, Canceling ticket, and
Refund money.
• Railway Reservation System: Use cases of the Railway
Reservation System are login, ticket availability, Fill the form,
Book ticket, Cancel ticket, and Refunding money.
• Admin: use cases of Admin are Print ticket, refund money.
Admin also controls the whole Railway Reservation System in
different cases.

You might also like