示例#1
0
        static void Main(string[] args)
        {
            int[] balances = { 100, 50, 1500, 160, 100, 1512, 7912 };
            var   machine  = new AtmMachine(balances);

            machine.InsertCard(2);
            machine.ShowBalance();
            machine.WithdrawCash(100);
            machine.WithdrawCash(300);
            machine.EjectCard();

            machine.InsertCard(0);
            machine.ShowBalance();
            machine.WithdrawCash(10);
            machine.EjectCard();
        }
示例#2
0
 public CardInsertedState(AtmMachine machine, int[] balances, int insertedCardNumber)
 {
     this.machine            = machine;
     this.currentBalances    = balances;
     this.insertedCardNumber = insertedCardNumber;
 }
示例#3
0
 public IdleState(AtmMachine machine, int[] balances)
 {
     this.machine         = machine;
     this.currentBalances = balances;
 }