change the state methos is missing in the ATM class object —that other state should change once completed there part ???
Course: Grokking the Low Level Design Interview Using OOD Principles - Learn Interactively
Lesson: Code for the ATM System
change the state methos is missing in the ATM class object —that other state should change once completed there part ???
Course: Grokking the Low Level Design Interview Using OOD Principles - Learn Interactively
Lesson: Code for the ATM System
Hello @Sahil_Siddiqui,
In the provided ATM design, the state transitions in the ATM are managed through the state classes (ATMState
, IdleState
, HasCardState
, etc.) and their respective methods. There isn’t a specific “changeState” method in the ATM
class because state changes occur based on the actions taken in the state methods themselves.
For example, in the HasCardState
class, the authenticatePin
method includes logic to check if the PIN is correct. If the PIN is correct, the method could change the state to SelectOperationState
by assigning a new state object to currentATMState
.
Happy Learning