Class and Sequence Diagram for ATM

Verified

Added on  2019/09/16

|7
|383
|606
Practical Assignment
AI Summary
This document presents a solution to a practical assignment involving the creation of class and sequence diagrams for an ATM system. The class diagram outlines the structure of the 'Account' and 'AccountData' classes, including their attributes and operations. The sequence diagram illustrates the flow of interactions for a specific sequence of operations: OPEN, LOGIN, PIN, DEPOSIT, BALANCE, suspend, and close. The solution provides a detailed view of how the system transitions between states and how data is managed during these operations.
Document Page
Class Diagram
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
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){
If(currState == 1) then
AccountData ad = new AccountData(p,y,a,”active”);
End if
}
Pin(int pin){
IF( currState = 1 && pin == ad.getPint())
Set S = LS[2];
END IF
}
Deposit(int d){
IF(currState = 2 )
Ad.deposit(d);
Document Page
End IF
}
Withdraw(int y){
IF(currState = 2 )
Ad.withdraw(y);
End IF
}
Balance(){
IF(currState = 2 )
Return ad.balance();
}
Logout(){
IF(currState = 2 )
S = LS[1];
End IF
}
Suspend(){
IF(currState = 2 )
Ad.setAccountStatus(“suspend”);
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
}
activated(){
IF(currState = 2 )
Ad.setAccountStatus(“activated”);
End IF
}
Close(){
IF(currState = 2 )
S = LS[1];
End IF
}
Class AccountData:
setPin(int pincode){
pin = pincode;
}
Deposit(int d){
Balance = balance + d;
}
withdraw(int w){
Document Page
Balance = balance - w;
}
Balance(){
Return balance;
}
setAccountStatus(String status){
accountStatus = status;
}
Sequence Diagram
Provide a sequence diagram for the following operation sequence:
OPEN(123,111,1000), LOGIN(111), PIN(123), DEPOSIT(200), BALANCE(),
suspend(), close.
Document Page
chevron_up_icon
1 out of 7
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]