コード例 #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();
        }
コード例 #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();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: jesconsa/Telerik-Academy
        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);
        }
コード例 #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);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: georgimanov/C-Sharp
        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);
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: ManoelPjr/EstudosCSharp
        /// <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();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: atree1987/MyWorks
        /// <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();
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #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
             */
        }
コード例 #14
0
ファイル: StatePattern.cs プロジェクト: yojan126/Learn
        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();
        }