예제 #1
0
 public string CashOut(int value, CurrencyType currency)
 {
     try
     {
         var cashOutAmountList = new List <(int value, int count)>();
         _handler.CashOut(cashOutAmountList, new Banknote(value, currency));
         return($"{value}{(char)currency} = {string.Join(" + ", cashOutAmountList.Select(t => $"{t.value}{(char)currency}*{t.count}"))}");
     }
     catch (Exception)
     {
         return($"Sorry, the bancomat can not cash {value}{(char) currency}");
     }
 }
예제 #2
0
        public IEnumerable <IBanknote> CashOut(string value)
        {
            var result = handler.CashOut(ref value);

            return(Regex.Match(value, @"^[^1-9]$").Success ? result : null);
        }
예제 #3
0
 //Обналичивает купюры, возвращает true, если смог обналичить, false если не смог обналичить
 public virtual bool CashOut(int amount, CurrencyType currency)
 {
     return(_nextHandler != null && _nextHandler.CashOut(amount, currency));
 }
예제 #4
0
 public bool CashOut(int amount, CurrencyType currency)
 {
     return(_handler.CashOut(amount, currency));
 }