示例#1
0
        static void Main(string[] args)
        {
            bool    exit      = false;
            Account myAccount = new Account();

            while (exit != true)
            {
                Console.WriteLine("Please select action: D - deposit, W - withdraw, E -exit.");
                string action = Console.ReadLine();
                if (action == "W")
                {
                    Console.WriteLine("Withdraw money: ");
                    decimal outputMoney = Convert.ToDecimal(Console.ReadLine());
                    myAccount.Withdraw(outputMoney);
                    myAccount.PrintStatement();
                }
                else if (action == "D")
                {
                    Console.WriteLine("Deposit money: ");
                    decimal inputMoney = Convert.ToDecimal(Console.ReadLine());
                    myAccount.Deposit(inputMoney);
                    myAccount.PrintStatement();
                }
                else if (action == "E")
                {
                    exit = true;
                }
                else
                {
                    Console.WriteLine("Undefined action.");
                }
            }
        }
示例#2
0
        static void Main()
        {
            var console = new Console();

            var clock = new Clock();

            var account = new Account(new AccountRepository(clock), new StatementPrinter(console));

            account.Deposit(100000);
            account.Withdraw(45000);
            account.Deposit(5);

            account.PrintStatement();

            System.Console.ReadLine();
        }