Exemplo n.º 1
0
        public override void Deposit(decimal amount)
        {
            if (amount >= MaxDepositAmount)
            {
                throw new User_Defined_Exceptions.ExceedDepositAmountException(MaxDepositAmount.ToString());
                //throw new Exception(string.Format("You can not deposit amount greater than {0}", MaxDepositAmount.ToString()));
            }

            AccountBalance     = AccountBalance + amount;
            TransactionSummary = string.Format("{0}\n Deposit:{1}", TransactionSummary, amount);
        }
Exemplo n.º 2
0
 public override void Deposit(decimal amount)
 {
     try
     {
         if (amount <= 0)
         {
             throw new IncorrectSumException(string.Format("Сумма операции не может быть отрицательной!"));
         }
         if (amount >= MaxDepositAmount)
         {
             throw new MaxAmountExceedException(string.Format("Превышена максимальная сумма депозита! Максимальная сумма депозита {0}", MaxDepositAmount.ToString()));
         }
         AccountBalance     = AccountBalance + amount;
         TransactionSummary = string.Format("{0}\n Deposit:{1}", TransactionSummary, amount);
     }
     catch (IncorrectSumException ex)
     {
         Console.WriteLine(ex.Message);
     }
     catch (MaxAmountExceedException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemplo n.º 3
0
        public override void Deposit(double amount)
        {
            if (amount >= MaxDepositAmount)
            {
                throw new Exception(string.Format("\nYou can not deposit amount greater than {0}", MaxDepositAmount.ToString()));
            }

            AccountBalance = AccountBalance + amount;

            TransactionSummary = string.Format("{0}\n Deposit:{1}", TransactionSummary, amount);
        }
        public override void Deposit(decimal amount)
        {
            if (amount <= 0)
            {
                throw new NonPositiveDepositAmountException("You can not deposit amount less than zero");
            }

            if (amount >= MaxDepositAmount)
            {
                throw new MaxDepositAmountException(string.Format("You can not deposit amount greater than {0}", MaxDepositAmount.ToString()));
            }

            AccountBalance     = AccountBalance + amount;
            TransactionSummary = string.Format("{0}\n Deposit:{1}", TransactionSummary, amount);
        }
Exemplo n.º 5
0
 public override void Deposit(decimal amount)
 {
     try
     {
         if (amount >= MaxDepositAmount)
         {
             throw new MaxDepositException(string.Format("You can not deposit amount greater than {0}", MaxDepositAmount.ToString()));
         }
         AccountBalance     = AccountBalance + amount;
         TransactionSummary = string.Format("{0}\n Deposit:{1}", TransactionSummary, amount);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Exemplo n.º 6
0
        public override void Deposit(decimal amount)

        {
            if (amount <= 0)
            {
                throw new NonPositiveDepositAmountException("Deposit amount must be positive");
            }

            if (amount >= MaxDepositAmount)
            {
                throw new MaxDepositAmountException($"Your maximum deposit amount is {MaxDepositAmount.ToString()}");
            }

            AccountBalance = AccountBalance + amount;

            TransactionSummary = string.Format("{0}\n Deposit:{1}", TransactionSummary, amount);
        }