Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.
/ atm Public archive

Bank Automated Teller Machine on Finite-State Machine

Notifications You must be signed in to change notification settings

mebr0/atm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ATM on FSM

Simple example of Finite-State Machines on Automated Teller Machine of some Bank

Written on Java with Polymorphism form

Main idea

Inspired by course of Program Principles 2 by @Beisenbek

Return to the idea of FSM after two years :)

All states are singleton classes with access to database and machine data. Have .next() method for each state. Only some states are final.

FSM schema

fsm

States

Start
  • s - request PIN
Finish
  • h - session finished
  • e - session finished with error
Intermediate
  • q0 - choose option in main menu
  • q1 - making transaction
  • q2 - enter sum to withdraw
  • q3 - output account cash
  • q4 - enter cash to replenish
  • q5 - enter sum and account to transfer
  • q6 - enter a pin to change

Actions

Pins
  • p0 - wrong PIN
  • p1 - correct PIN
Menu
  • m0 - returning to menu
  • m1 - choosing invalid option at menu
Finishing
  • e0 - finishing session
  • e1 - system error
Other
  • z0 - choosing to withdraw cash
  • z1 - asserting withdrawing
  • z2 - checking account
  • z3 - choosing to replenish cash
  • z4 - asserting replenish
  • z5 - enter sum again
  • z6 - choosing to transfer sum
  • z7 - asserting transfer
  • z8 - enter account again
  • z9 - choosing change pin
  • z10 - enter a pin again (wrong pin)

JSON schema

Schema can be opened via this link

About

Bank Automated Teller Machine on Finite-State Machine

Topics

Resources

Stars

Watchers

Forks

Languages