Esempio n. 1
0
		static void Main(string[] args)
		{
            OverdraftProtection op = new OverdraftProtection(500);
            Account.DebitPolicy policy;
            policy = new Account.DebitPolicy(op.HandleDebit);
            Account myAccount = new Account(100, policy);

            bool done = false;
            do
            {
                DisplayMenu();
                string choice = Console.ReadLine();
                switch(choice.ToLower())
                {
                    case "w":
                        HandleWithdrawal(myAccount);
                        break;

                    case "d":
                        HandleDeposit(myAccount);
                        break;

                    case "q":
                        done = true;
                        break;

                    default:
                        InvalidChoice(choice);
                        break;
                }
                CurrentBalance(myAccount, op);
            }while(!done);
		}
Esempio n. 2
0
 static void CurrentBalance(Account anAccount, OverdraftProtection op)
 {
     Console.WriteLine("Balance is {0}", anAccount.Balance);
     Console.WriteLine("Available overdraft is {0}", op.AvailableLoan);
     Console.WriteLine("Current overdraft loan is {0}", op.CurrentLoan);
 }
Esempio n. 3
0
 static void CurrentBalance(Account anAccount, OverdraftProtection op)
 {
     Console.WriteLine("Balance is {0}", anAccount.Balance);
     Console.WriteLine("Available overdraft is {0}", op.AvailableLoan);
     Console.WriteLine("Current overdraft loan is {0}", op.CurrentLoan);
 }