Пример #1
0
        public override transaction withdral(decimal amount)

        {
            //Create Transaction object
            transaction thisTransaction = new transaction();

            thisTransaction.AccountNumbert = AccountNumber;
            thisTransaction.Amount         = amount;
            thisTransaction.isSuccessful   = false;
            thisTransaction.TimeStamp      = DateTime.Now;


            //try to process transaction
            if (amount > Balance)
            {
                thisTransaction.Detail = "Transaction Failed: Insufficient Funds.";
                Console.WriteLine("Trasactioin Failed: Insufficient Funds.");
            }
            else
            {
                Balance -= amount;  // Balance = Balance - amount;
                thisTransaction.isSuccessful = true;
                thisTransaction.Detail       = string.Format("Account#: {0} was debited {1}", thisTransaction.AccountNumbert, thisTransaction.Amount);
                Console.WriteLine("Successfully withdrew from " + thisTransaction.AccountNumber + " debited amount of" + thisTransaction.Amount);
            }

            return(thisTransaction);
        }
Пример #2
0
            public void ProcessProfit()
        {
            Balance += Balance * InterestRate;

            // Implement the withdrawl transaction logic here

            transaction thisTransaction = new transaction();
            thisTransaction.AccountNumbert = AccountNumber;
            thisTransaction.Amount = amount;
            thisTransaction.TimeStamp = DateTime.Now;
            thisTransaction.isSuccessful = false;

            //perform withdrawl

            if (amount > Balance)

            {
                thisTransaction.Detail = "Transaction failed, Insufficient Balance. $ " + Balance;
                Console.WriteLine("Transaction Failed, Insufficient Balance.");

            }

            else if (WithdrawlsThisMonth > MONTHLY_WITHDRAWL_LIMIT)
            {
                thisTransaction.Detail = "Transaction Failed, due to monthly withdrawl limit");
            }
            else
            {
                Balance += amount;
                thisTransaction.isSuccessful = true;
                thisTransaction.Detail = "Debit Transaction for account number" + AccountNumber + "With the amount of $" + amount;
                Console.WriteLine("thisTransaction.Detail");

            }

            return thisTransaction;



        }