Ejemplo n.º 1
0
        internal static void Main()
        {
            var account = new Account("Jim Johnson");

            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(2000.00);
            account.Withdraw(1100.00);
            account.Deposit(5000.00);
            account.PayInterest();
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            // Open a new account
            var account = new Account("Jim Oliver");

            // Apply financial transactions
            account.Deposit(500m);
            account.Deposit(300m);
            account.Deposit(550m);
            account.PayInterest();
            account.Withdraw(2000m);
            account.Withdraw(1100m);
            account.PayInterest();

            Console.ReadKey();
        }
Ejemplo n.º 3
0
        internal static void Main()
        {
            var account = new Account("Jim Johnson");

            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(2000.00);
            account.Withdraw(1100.00);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var account = new Account("Jim Johnson");

            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(1000.00);
            account.Withdraw(1100.00);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            var account = new Account("Pesho Peshev");

            account.Deposit(500.0m);
            account.Deposit(300.0m);
            account.Deposit(550.0m);
            account.PayInterest();
            account.Withdraw(1000.00m);
            // try unreal situation
            account.Withdraw(1100.00m);
        }
Ejemplo n.º 6
0
        public static void Main()
        {
            // Open a new account
            Account account = new Account("Jim Johnson");

            // Apply financial transactions
            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(2000.00);
            account.Withdraw(1100.00);
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Account account = new Account("Jim Johnson");

            account.Deposit(500);
            account.Deposit(300);
            account.Deposit(550);
            account.PayInterest();
            account.Withdraw(2000);
            account.Withdraw(1100);

            Console.ReadKey();
        }
Ejemplo n.º 8
0
        internal static void Main()
        {
            var account = new Account("Jim Johnson");

            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(2000.00);
            account.Withdraw(1100.00);

            // Wait for user
            Console.ReadKey();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            // Open a new account
            Account account = new Account("Reynald Adolphe");

            // Apply transacitons
            account.Deposit(490.0);
            account.Deposit(390.0);
            account.Deposit(540.0);
            account.PayInterest();
            account.Withdraw(2200.0);
            account.Withdraw(1300.0);

            // Wait
            Console.ReadKey();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            // Open a new account
            Account account = new Account("Jim Johnson");

            // Apply financial transactions
            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(2000.00);
            account.Withdraw(1100.00);

            // Wait for user
            Console.ReadKey();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// The test second.
        /// </summary>
        private static void TestSecond()
        {
            // Open a new account
            Account account = new Account("Jim Johnson");

            // Apply financial transactions
            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(2000.00);
            account.Withdraw(1100.00);

            // Wait for user
            Console.ReadKey();
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            //开一个新的账户
            Account account = new Account("yesir");

            //进行交易
            //存钱
            account.Deposit(1000);
            account.Deposit(200);
            account.Deposit(600);

            //付利息
            account.PayInterest();

            //取钱
            account.Withdraw(2000);
            account.Withdraw(500);
            Console.ReadKey();
        }
Ejemplo n.º 13
0
        public static void Run()
        {
            Console.WriteLine("This real-world code demonstrates the State pattern which allows an Account to behave differently depending on its balance. The difference in behavior is delegated to State objects called RedState, SilverState and GoldState. These states represent overdrawn accounts, starter accounts, and accounts in good standing.\n");

            Account account = new Account("Jim Johnson");

            account.Deposit(500.0);
            account.Deposit(300.0);
            account.Deposit(550.0);
            account.PayInterest();
            account.Withdraw(2000.00);
            account.Withdraw(1100.00);

            /*
             * Deposited $500.00 ---
             * Balance = $500.00
             * Status = SilverState
             *
             *
             * Deposited $300.00 ---
             * Balance = $800.00
             * Status = SilverState
             *
             *
             * Deposited $550.00 ---
             * Balance = $1,350.00
             * Status = GoldState
             *
             *
             * Interest Paid ---
             * Balance = $1,417.50
             * Status = GoldState
             *
             * Withdrew $2,000.00 ---
             * Balance = ($582.50)
             * Status = RedState
             *
             * No funds available for withdrawal!
             * Withdrew $1,100.00 ---
             * Balance = ($582.50)
             * Status = RedState
             */
        }
Ejemplo n.º 14
0
        public static void DoThis()
        {
            // 开一个新账户
            Account account = new Account("John");

            // 进行交易
            // 存钱
            account.Deposit(200.00);
            account.Deposit(500.00);
            account.Deposit(20000.00);
            Console.ReadLine();

            // 付利息
            account.PayInterest();
            Console.ReadLine();

            // 取钱
            account.Withdraw(20000.00);
            account.Withdraw(10000.00);

            Console.ReadLine();
        }