Esempio n. 1
0
        public override void MakeWithdrawal(decimal withdrawal, DateTime dateTime)
        {
            AccountManager accountManager = new AccountManager();

            if (dateTime < DateOfTransaction.AddYears(1))
            {
                Console.WriteLine("Cannot make a withdrawal until end of term");
            }
            else if (withdrawal != Balance)
            {
                Console.WriteLine("Must withdraw full amount from your Certificate Deposit");
            }
            else
            {
                string withdrawalString = withdrawal.ToString();
                WithdrawalString = "+$" + withdrawalString;
                WithdrawalAmount = withdrawal;
                Balance         -= withdrawal;
                var completeWithdrawal = new Transaction(Balance, WithdrawalString, WithdrawalAmount, dateTime);
                transactions.Add(completeWithdrawal);
                UI.CloseCDOnWithdrawal();
                Console.WriteLine("This account will now be closed.");
                UI.OnEnterPress();
                Program.ExecuteUserInput();
            }
        }