コード例 #1
0
ファイル: MAIN.CS プロジェクト: ppatoria/SoftwareDevelopment
		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);
		}
コード例 #2
0
ファイル: MAIN.CS プロジェクト: ppatoria/SoftwareDevelopment
 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);
 }
コード例 #3
0
ファイル: main.cs プロジェクト: poohpaintii/book-source-codes
 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);
 }