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); }
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); }