コード例 #1
0
        static void Main(string[] args)
        {
            Customer cust1 = new Customer
            {
                FirstName = "Alice",
                Checking  =
                {
                    Id     = "My checking",
                    Amount =       100.00m,
                    IsOpen = true,
                    Type   = AccountType.Checking
                },
                Savings =
                {
                    Amount =        0.00m,
                    Id     = "My Savings",
                    IsOpen = false,
                    Type   = AccountType.Savings
                }
            };

            cust1.Transfer(50m, AccountType.Checking, AccountType.Savings);

            Console.WriteLine(cust1.Checking.Amount);
            Console.WriteLine(cust1.Savings.Amount);
            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Customer alice = new Customer
            {
                FirstName      = "Alice",
                MiddleInitial  = "N",
                LastName       = "Wonderland",
                BillingAddress = new Address
                {
                    Street = "210 Jackson Street",
                    City   = "Houston",
                    ZIP    = "70512"
                },
                CheckingAccount = new Account
                {
                    IdNum   = 789321456,
                    Type    = AccountType.Checking,
                    Balance = 100m,
                    IsOpen  = true
                },
                SavingsAccount = new Account
                {
                    IdNum   = 789321654,
                    Type    = AccountType.Savings,
                    Balance = 0m,
                    IsOpen  = false
                }
            };

            Console.WriteLine(string.Format("{0} {1} {2}", alice.FirstName, alice.MiddleInitial, alice.LastName));

            Customer.Transfer(alice.CheckingAccount, alice.SavingsAccount, 23.45m);
            Console.WriteLine(string.Format("{0} has {1} in checking and {2} in savings.", alice.FirstName, alice.CheckingAccount.Balance, alice.SavingsAccount.Balance));

            //pause
            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: LindseyNastos/Labs
        static void Main(string[] args)
        {
            var customer1 = new Customer
            {
                Name = "Alice",
                CheckingAccount =
                {
                    Id = 98235,
                    Type = "Checking",
                    Amount = 100.00m,
                    IsOpen = true
                },
                SavingsAccount =
                {
                    Id = 23468,
                    Type = "Savings",
                    Amount = 0.00m,
                    IsOpen = false
                }
            };

            customer1.Transfer(50.00m);

        }
コード例 #4
0
ファイル: Program.cs プロジェクト: Jerflem1387/July6Troop2015
        static void Main(string[] args)
        {
            Customer cust1 = new Customer
            {
                FirstName = "Alice",
                Checking =
                {
                    Id = "My checking",
                    Amount = 100.00m,
                    IsOpen = true,
                    Type = AccountType.Checking

                },
                Savings =
                {
                    Amount = 0.00m,
                    Id = "My Savings",
                    IsOpen = false,
                    Type = AccountType.Savings
                }
            };
            cust1.Transfer(50m, AccountType.Checking, AccountType.Savings);

            Console.WriteLine(cust1.Checking.Amount);
            Console.WriteLine(cust1.Savings.Amount);
            Console.ReadLine();
        }