ATM System Class and Sequence Diagrams
VerifiedAdded on 2019/09/19
|11
|637
|173
Practical Assignment
AI Summary
This document presents a solution for an ATM system design, focusing on class and sequence diagrams. The class diagram outlines the structure of the system, including classes like Account, AccountData, and ATMState, along with their attributes and operations. The sequence diagram illustrates the interaction between objects for a specific sequence of operations: OPEN, LOGIN, PIN, DEPOSIT, BALANCE, suspend, and close. The solution provides a detailed look at how the system transitions between states and manages account data.

Contents
Centralized.......................................................................................................................................1
Class Diagram..............................................................................................................................1
Sequence Diagram...........................................................................................................................6
Centralized.......................................................................................................................................1
Class Diagram..............................................................................................................................1
Sequence Diagram...........................................................................................................................6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Centralized
Class Diagram
Class Diagram

⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Class Account:
S// point to current state
LS[0] // point to start state
LS[1] // point to idle state
LS[2] // point to ready state
Operations:
create(){
S->create()
currState = S.getID()
IF currState == 0 THEN
S = LS[1] //change ATM state from “Start” to “Idle”
ENDIF
}
Open(int p, int y, int a){
S->open(p,y,a);
currState = S.getID()
If(currState == 1) then
AccountData ad = new AccountData(p,y,a,”active”);
End if
}
Pin(int p){
S->pin(p)
currState = S.getID()
IF( currState = 1 && p == ad.getPint())
Set S = LS[2];
END IF
}
S// point to current state
LS[0] // point to start state
LS[1] // point to idle state
LS[2] // point to ready state
Operations:
create(){
S->create()
currState = S.getID()
IF currState == 0 THEN
S = LS[1] //change ATM state from “Start” to “Idle”
ENDIF
}
Open(int p, int y, int a){
S->open(p,y,a);
currState = S.getID()
If(currState == 1) then
AccountData ad = new AccountData(p,y,a,”active”);
End if
}
Pin(int p){
S->pin(p)
currState = S.getID()
IF( currState = 1 && p == ad.getPint())
Set S = LS[2];
END IF
}
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Deposit(int d){
S->deposit(d);
currState = S.getID()
IF(currState = 2 )
Ad.deposit(d);
End IF
}
Withdraw(int y){
S->withdraw(y);
currState = S.getID()
IF(currState = 2 )
Ad.withdraw(y);
End IF
}
S->deposit(d);
currState = S.getID()
IF(currState = 2 )
Ad.deposit(d);
End IF
}
Withdraw(int y){
S->withdraw(y);
currState = S.getID()
IF(currState = 2 )
Ad.withdraw(y);
End IF
}

Balance(){
S->balance()
currState = S.getID()
IF(currState = 2 ) THEN
Return ad.balance();
END IF
}
Logout(){
S->logout()
currState = S.getID()
IF(currState = 2 ) THEN
S = LS[1];
End IF
}
Suspend(){
S->suspend()
currState = S.getID()
IF(currState = 2 ) THEN
Ad.setAccountStatus(“suspend”);
End IF
}
S->balance()
currState = S.getID()
IF(currState = 2 ) THEN
Return ad.balance();
END IF
}
Logout(){
S->logout()
currState = S.getID()
IF(currState = 2 ) THEN
S = LS[1];
End IF
}
Suspend(){
S->suspend()
currState = S.getID()
IF(currState = 2 ) THEN
Ad.setAccountStatus(“suspend”);
End IF
}
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

activated(){
S->activated()
currState = S.getID()
IF(currState = 2 ) THEN
Ad.setAccountStatus(“activated”);
End IF
}
Close(){
S->close()
currState = S.getID()
IF(currState = 2 ) THEN
S = LS[1];
End IF
}
Class AccountData:
setPin(int pincode){
pin = pincode
}
Deposit(int d){
S->activated()
currState = S.getID()
IF(currState = 2 ) THEN
Ad.setAccountStatus(“activated”);
End IF
}
Close(){
S->close()
currState = S.getID()
IF(currState = 2 ) THEN
S = LS[1];
End IF
}
Class AccountData:
setPin(int pincode){
pin = pincode
}
Deposit(int d){
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Balance = balance + d
}
withdraw(int w){
Balance = balance - w;
}
Balance(){
Return balance;
}
setAccountStatus(String status){
accountStatus = status;
}
Class “ATMState”
getID(){
Return ID;
}
Class “Start”
ID = 0
Create(){
// no action defined
}
Class “Idle”
}
withdraw(int w){
Balance = balance - w;
}
Balance(){
Return balance;
}
setAccountStatus(String status){
accountStatus = status;
}
Class “ATMState”
getID(){
Return ID;
}
Class “Start”
ID = 0
Create(){
// no action defined
}
Class “Idle”

ID = 1
pin(int p){
Ad.setPint(p);
}
open(int p,int y,int a){
ad.setPin(p)
ad.setIdentification(y)
ad.setBalance(a)
}
login(int y){
ad.setsetIdentification(y)
}
Class “Ready”
ID = 3
deposit(int d){
Ad.setBalance(ad.getBalace() + d)
}
withdraw(int w){
ad.setBalance(ad.getBalance() – w)
}
balance(){
// display ad.getBalance()
}
close(){
// eject card
}
pin(int p){
Ad.setPint(p);
}
open(int p,int y,int a){
ad.setPin(p)
ad.setIdentification(y)
ad.setBalance(a)
}
login(int y){
ad.setsetIdentification(y)
}
Class “Ready”
ID = 3
deposit(int d){
Ad.setBalance(ad.getBalace() + d)
}
withdraw(int w){
ad.setBalance(ad.getBalance() – w)
}
balance(){
// display ad.getBalance()
}
close(){
// eject card
}
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Sequence Diagram
Provide a sequence diagram for the following operation sequence:
OPEN(123,111,1000), LOGIN(111), PIN(123), DEPOSIT(200), BALANCE(),
suspend(), close.
Provide a sequence diagram for the following operation sequence:
OPEN(123,111,1000), LOGIN(111), PIN(123), DEPOSIT(200), BALANCE(),
suspend(), close.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

1 out of 11
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.