Beispiel #1
0
 public void InputCard(Creditcard creditcard)
 {
     if(actualMachine.ValidateCreditCard(creditcard))
     {
         actualMachine.SetState(actualMachine.cardExistsState());
     }
     else { throw new UnAuthorizedUseException("This card is not valid, please contact Bank"); }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            Customer benvolio = new Customer("Benvolio ", "Montague");
            Creditcard credit1 = new Creditcard(benvolio, "554512345678", "0234");
            CashAccount c1 = new CashAccount(benvolio, 10000);
            ATM myATM = ATM.getinstance();

            try
            {
                myATM.InputCard(credit1);
                myATM.InputPin("0234");
                myATM.RequestWithdrawal(c1, 9000);
                myATM.RequestBalance(c1);
                myATM.EjectCard();

            }
            catch (UnauthorizedAccessException u) { Console.WriteLine(u.Message); }
            catch (IllegalOperationException i) { Console.WriteLine(i.Message); }
            catch (LimitExceedException l) { Console.WriteLine(l.Message); }
            Console.ReadKey();
        }
Beispiel #3
0
 public void InputCard(Creditcard creditcard)
 {
     throw new IllegalOperationException("There is already a card in the ATM");
 }
Beispiel #4
0
 public bool ValidateCreditCard(Creditcard creditcard)
 {
     if (creditcard.ValidateCreditcard(creditcard))
     {
         this.activeCreditcard = creditcard;
         return true;
     }
     else { return false; }
 }
Beispiel #5
0
 public void InputCard(Creditcard creditcard)
 {
     atmState.InputCard(creditcard);
 }
Beispiel #6
0
 public bool ValidateCreditcard(Creditcard creditcard)
 {
     if (creditcard.owner.GetCustomerId() != 0 && pinCode != null) { return true; }
        else { return false; }
 }