Ejemplo n.º 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"); }
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 3
0
 public void InputCard(Creditcard creditcard)
 {
     throw new IllegalOperationException("There is already a card in the ATM");
 }
Ejemplo n.º 4
0
Archivo: ATM.cs Proyecto: mv00/atmTest
 public bool ValidateCreditCard(Creditcard creditcard)
 {
     if (creditcard.ValidateCreditcard(creditcard))
     {
         this.activeCreditcard = creditcard;
         return true;
     }
     else { return false; }
 }
Ejemplo n.º 5
0
Archivo: ATM.cs Proyecto: mv00/atmTest
 public void InputCard(Creditcard creditcard)
 {
     atmState.InputCard(creditcard);
 }
Ejemplo n.º 6
0
 public bool ValidateCreditcard(Creditcard creditcard)
 {
     if (creditcard.owner.GetCustomerId() != 0 && pinCode != null) { return true; }
        else { return false; }
 }