forked from ramram43210/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.java
More file actions
44 lines (34 loc) · 1.27 KB
/
Copy pathClient.java
File metadata and controls
44 lines (34 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
public class Client
{
public static void main( String[] args )
{
/*
* Initially ATM Machine in 'noDebitCardState'
*/
AtmMachine atmMachine = new AtmMachine();
System.out.println("ATM Machine Current state : "
+ atmMachine.getAtmMachineState().getClass().getName());
System.out.println();
atmMachine.enterPinAndWithdrawMoney();
atmMachine.ejectDebitCard();
atmMachine.insertDebitCard();
System.out.println("\n*******************************************************");
/*
* Debit Card has been inserted so internal state of ATM Machine
* has been changed to 'hasDebitCardState'
*/
System.out.println("\nATM Machine Current state : "
+ atmMachine.getAtmMachineState().getClass().getName());
System.out.println();
atmMachine.enterPinAndWithdrawMoney();
atmMachine.insertDebitCard();
atmMachine.ejectDebitCard();
System.out.println("\n*******************************************************");
/*
* Debit Card has been ejected so internal state of ATM Machine
* has been changed to 'noDebitCardState'
*/
System.out.println("\nATM Machine Current state : "
+ atmMachine.getAtmMachineState().getClass().getName());
}
}