Question: write the code in java state machine Bank ATM service Idle in(card) IS fixed cancel Out of Service Active The above figure is a simple

write the code in java
state machine Bank ATM service Idle in(card) IS fixed cancel Out of Service Active The above figure is a simple state diagram of a bank ATM. The ATM will be in one of the three states: Idle (default), Active and Out of Service. To implement the ATM's state machine: 1. Use a nested class, called StateMachine, inside the ATM class. 2. All events received by the ATM are delegated to the State Machine. These events are Service (), Fixed(), Cancel() and Incard(). 3. The ATM and the State Machine classes have references to each other (i.e. each class has a field of type the other class). 4. Inside the State Machine class, we use: a. Two Java enums: event and State i. The event enum represents all events. ii. The State enum represents all states in the state machine. 5.Declare a class called ATMTest that contains: a. A static void method called SendEvent() that accepts an event, decides which transition to execute and then prints the current state of the state machine. Hint: call Service (), Fixed(), Cancel() or InCard() methods. b. The main() method to test the SendEvent(). To answer the above mentioned questions, complete the following
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
