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