ATM System Class and Sequence Diagrams

Verified

Added 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.
Document Page
Contents
Centralized.......................................................................................................................................1
Class Diagram..............................................................................................................................1
Sequence Diagram...........................................................................................................................6
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Centralized
Class Diagram
Document Page
Document Page
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
}
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
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
}
Document Page
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
}
Document Page
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){
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
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”
Document Page
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
}
Document Page
Sequence Diagram
Provide a sequence diagram for the following operation sequence:
OPEN(123,111,1000), LOGIN(111), PIN(123), DEPOSIT(200), BALANCE(),
suspend(), close.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]