Ooad Lab Expt1
Ooad Lab Expt1
Purpose:
The purpose of the class diagram is to model the static view of an application. The class diagrams are
the only diagrams which can be directly mapped with object oriented languages and thus widely used
at the time of construction. The UML diagrams like activity diagram, sequence diagram can only give
the sequence flow of the application but class diagram is a bit different. So it is the most popular UML
diagram in the coder community. So the purpose of the class diagram can be summarized as:
Contents:
• Classes
• Interfaces
• Collaborations
• Dependency, generalization and association relationships
Procedure:-
Step1: First Classes are created.
Step2: Named as PinValid, Account Type, Transaction, Update, Server, Customer classes are
created.
Step3: Appropriate relationships are provided between them as association.
1
DIAGRAM:
Inferences:
Applications:
Online transaction
Online banking
2
B) NAME OF EXPERIMENT: Use case diagram for ATMSystem.
AIM: To design and implement ATM System through Use case Diagram.
Purpose:
The purpose of use case diagram is to capture the dynamic aspect of a system. Because other four
diagrams (activity, sequence, collaboration and State chart) are also having the same purpose. So we
will look into some specific purpose which will distinguish it from other four diagrams. Use case
diagrams are used to gather the requirements of a system including internal and external influences.
These requirements are mostly design requirements. So when a system is analyzed to gather its
functionalities use cases are prepared and actors are identified.
Procedure:
Step3: A use case Enter PIN, Withdraw money is created and connected with user as association
relationship.
Step4: Similarly various use cases like Deposit money, Balance Enquiry, Manage Account etc are
created and appropriate relationships are associated with each of them.
3
DIAGRAM:
Enter PIN
Withdraw Money
Balance enquiry
ATM admin
Customer
Deposit
Abort/ Cancel
Print Receipt
Manage Account
Withdrawal UseCase
A withdrawal transaction asks the customer to choose a type of account to withdraw from (e.g.
checking) from a menu of possible accounts, and to choose an amount from a menu of possible
amounts. The system verifies that it has sufficient money on hand to satisfy the request before sending
the transaction to the bank. (If not, the customer is informed and asked to enter a different amount.) If
the transaction is approved by the bank, the appropriate amount of cash is dispensed by the machine
before it issues a receipt. A withdrawal transaction can be cancelled by the customer pressing the
Cancel key any time prior to choosing the amount.
Deposit UseCase
A deposit transaction asks the customer to choose a type of account to deposit to (e.g. checking) from
a menu of possible accounts, and to type in amount on the keyboard. The transaction is initially sent to
the bank to verify that the ATM can accept a deposit from this customer to this account. If the
4
transaction is approved, the machine accepts an envelope from the customer containing cash and/or
checks before it issues a receipt. Once the envelope has been received, a second message is sent to the
bank, to confirm that the bank can credit the customer‟s account – contingent on manual verification
of the deposit envelope contents by an operator later.
A deposit transaction can be cancelled by the customer pressing the Cancel key any time prior to
inserting the envelope containing the deposit. The transaction is automatically cancelled if the
customer fails to insert the envelope containing the deposit within a reasonable period of time after
being asked to do so.
InquiryUseCase
An inquiry transaction asks the customer to choose a type of account to inquire about from a menu of
possible accounts. No further action is required once the transaction is approved by the bank before
printing the receipt. An inquiry transaction can be cancelled by the customer pressing the Cancel key
any time prior to choosing the account to inquire about.
This use case is for validate the user i.e. check the pin number, when the bank reports that the
customer‟s transaction is disapproved due to an invalid PIN. The customer is required to re-enter the
PIN and the original request is sent to the bank again. If the bank now approves the transaction, or
disapproves it for some other reason, the original use case is continued; otherwise the process of re-
entering the PIN is repeated. Once the PIN is successfully re-entered
If the customer fails three times to enter the correct PIN, the card is permanently retained, a screen is
displayed informing the customer of this and suggesting he/she contact the bank, and the entire
customer session is aborted.
This usecase is for printing corresponding bill after transactions (withdraw or deposit, or balance
enquiry, transfer) are completed.
Manage Account
This use case is for updating corresponding user accounts after transactions (withdraw or deposit or
transfer) are completed.
5
RESULT:
Inferences:
1. Identification of use cases.
2. Identification of actors.
INTERACTIONDIAGRAMS
We have two types of interaction diagrams in UML. One is sequence diagram and the other is
a collaboration diagram. The sequence diagram captures the time sequence of message flow from one
object to another and the collaboration diagram describes the organization of objects in a system
taking part in the message flow.
So the following things are to be identified clearly before drawing the interaction diagram:
Purpose:
Objects
Focus of control
Messages
Life line
Objects
Links
Messages
6
Procedure:-
Step4: In sequence diagram interaction is done through time ordering of messages. So appropriate
messages are passed between user and ATM is as shown in the figure.
DIAGRAM:
ATM ADMIN
check pin no
pin valid/invalid
check account
display status
check amount
display status
Update account
7
D) NAME OF EXPERIMENT: collaboration for ATMSystem.
Procedure:-
Step4: So appropriate messages are passed between user and ATM as shown in the figure.
DIAGRAM:
1: check pin no
3: check account
5: check amount
7: update account
AT ADMIN
M
2: pin valid/invalid
4: display status
6: display status
8
WITHDRAWUseCase:
SEQUENCE DIAGRAM
2: Validate Pin
3: Validate
4: Choose Transaction
5: Withdraw
6: Check Balance
7: Sufficiant Balance
8: Creadit cash
9: Insufficiant Balance
COLLABORATION DIAGRAM
5: Withdraw
8: Creadit cash : ATM
10: Low balance machine
3: Validate
7: Sufficiant Balance
9: Insufficiant Balance
2: Validate Pin
6: Check Balance
: Bank
server
9
ENQUIRYUseCase:
SEQUENCE DIAGRAM:
customer
:session :Bank
server
1: Insert
Card
2: Obtain Pin
3: Enter Pin
4: Send Pin
5: Request
7: Type
9: seif
10
COLLABARATION DIAGRAM:
custome
r
1: Insert Card
7: Type
9: seif
3: Enter Pin
5: Request
6: Obtain types of enquiry
:session
11: Current bal
13: Previous trans
15: Display(a/c no,bal,names)
2: Obtain Pin
4: Send Pin
8: Get a/cno's
: Bank
10: Bal enquiry
server
12: Transactionhistory
14: View a/c details
DEPOSITUseCase:
SEQUENCE DIAGRAM:
2: Obtain Pin
3: Enter Pin
4: Validate Pin
5: Valid Pin
10: Enveloprecived
11
COLLABARATION DIAGRAM:
1: Insert card
3: Enter Pin
custome 7: Deposit Amt
r
5: Valid Pin
4: Validate Pin
: Bank
server
STATECHARTDiagram
State Chart diagram is used to model dynamic nature of a system. They define different states of an
object during its lifetime. And these states are changed by events. State chart diagram describes the
flow of control from one state to another state.
States are defined as a condition in which an object exists and it changes when some event is
triggered. But the main purpose is to model reactive system.
Contents
• Simply state and composite states
• Transitions, including events and actions
AIM: To design and implement ATM System through State Chart diagram.
Purpose:
12
3. To describe different states of an object during its life time.
4. Defines a state machine to model states of an object.
Procedure:-
Step1: First after initial state control undergoes transition to ATM screen.
Step2: After inserting card it goes to the state wait for pin.
Step4:. In this way it undergoes transitions to various states and finally reaches the ATM screen state
as shown in the fig.
DIAGRAM:
13
STATE CHART FOR ATM
next
enter/pressed validate invalid
number
valid
complete cancelled
THEORY: An activity diagram shows the flow from activity to activity .An activity is an ongoing non
atomic execution within a state machine .Activities ultimately results in some action, which is made up
of executable atomic computations. We can use these diagrams to model the dynamic aspects of a
system.
Activity diagram is basically a flow chart to represent the flow form one activity to another . The
activity can be described as an operation of the system. So the control flow is drawn from one
operation to another. This flow can be sequential, branched or concurrent. Activity diagrams deals
with all type of flow by using elements like fork, join etc.
Contents
14
Fork
A fork represents the splitting of a single flow of control into two or more concurrent Flow of control.
A fork may have one incoming transition and two or more outgoing transitions, each of which
represents an independent flow of control. Below fork the activities associated with each of these path
continues in parallel.
Join
A join represents the synchronization of two or more concurrent flows of control. A join may have
two or more incoming transition and one outgoing transition. Above the join the activities associated
with each of these paths continues in parallel.
Branching
A branch specifies alternate paths takes based on some Boolean expression Branch is represented by
diamond Branch may have one incoming transition and two or more outgoing one on each outgoing
transition, you place a Boolean expression shouldn‟t overlap but they should cover all possibilities.
Swimlane:
Swimlanes are useful when we model workflows of business processes to partition the activity states
on an activity diagram into groups. Each group representing the business organization responsible for
those activities, these groups are called Swimlanes .
Procedure:-
DIAGRAM:
15
Activity diagram for Transactions:
16
customer ATM bank serv er
insert card
:transaction
withdraw
receive cash
close
:receipt transaction
print
Inferences:
17
G) NAME OF EXPERIMENT: Component diagram for ATMSystem.
THEORY:
Component diagrams are used to model physical aspects of a system. Physical aspects are the
elements like executables, libraries, files, documents etc which resides in a node. So component
diagrams are used to visualize the organization and relationships among components in a system.
These diagrams are also used to make executable systems.
Purpose:
Before drawing a component diagram the following artifacts are to be identified clearly:
• Use a meaningful name to identify the component for which the diagram is to be drawn.
• Prepare a mental layout before producing using tools.
• Use notes for clarifying important points.
Contents
Procedure:-
Step3: In it various components such as withdraw money, deposit money, check balance, transfer
money etc. are created.
18
Step4: Association relationship is established between user and other components.
DIAGRAM:
customer ATM
account Machine
bank
balance
withdraw enquiry
checking
account saving
account
Purpose:
Deployment diagrams are used to visualize the topology of the physical components of a system
where the software components are deployed. So deployment diagrams are used to describe the static
deployment view of a system. Deployment diagrams are used for describing the hardware
components where software components are deployed. Component diagrams and deployment
diagrams are closely related. Component diagrams are used to describe the components and
deployment diagrams shows how they are deployed in hardware.
Procedure:-
Step1: First user node is created
19
Step2: various nodes withdraw money, deposit money, and check balance, transfer money etc. are
created.
Step4: Association relationship is established between user and other nodes.
Step5: Dependency is established between deposit money and check balance.
bank
Atm machine server
location b
20
21