当前位置: 首页>>代码示例>>C#>>正文


C# Bank.RemoveAccount方法代码示例

本文整理汇总了C#中Bank.RemoveAccount方法的典型用法代码示例。如果您正苦于以下问题:C# Bank.RemoveAccount方法的具体用法?C# Bank.RemoveAccount怎么用?C# Bank.RemoveAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bank的用法示例。


在下文中一共展示了Bank.RemoveAccount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main()
    {
        var bank = new Bank("International Asset Bank");

        bank.AddAccount(
            new DepositAccount(CustomerType.Individual, 2330, 45).WithDraw(250.23m), // Test WithDraw()
            new LoanAccount(CustomerType.Company, 250, 25).Deposit(250.23m), // Test Deposit()
            new LoanAccount(CustomerType.Individual, 444, 44), // Remove
            new MortgageAccount(CustomerType.Company, 2300, 15));

        bank.RemoveAccount(new LoanAccount(CustomerType.Individual, 444, 44));

        Console.WriteLine(bank);

        /* ------------ */

        Console.WriteLine(new DepositAccount(CustomerType.Individual, 2330, 45).CalculateInterestAmount(20));

        Console.WriteLine(new LoanAccount(CustomerType.Company, 250, 25).Deposit(250.23m).CalculateInterestAmount(15));

        Console.WriteLine(new MortgageAccount(CustomerType.Company, 2300, 15).CalculateInterestAmount(45) + "\n\n");

        /* ------------ */

        Console.WriteLine(new DepositAccount(CustomerType.Individual, 2330, 45));
    }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:26,代码来源:Program.cs

示例2: Main

    static void Main(string[] args)
    {
        Bank myBank = new Bank();
        myBank.AddAccount(new DepositAccount(Customer.Company, 200m, 1.5m));
        myBank.AddAccount(new LoanAccount(Customer.Individual, -20, 2m));
        myBank.AddAccount(new MortgageAccount(Customer.Individual, -100m, 3m));

        Account acc = new DepositAccount(Customer.Individual, 200m, 4m);
        myBank.AddAccount(acc);

        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }

        myBank.RemoveAccount(acc);

        if (acc is DepositAccount)
        {
            DepositAccount changeAcc = acc as DepositAccount;
            changeAcc.Deposit(1000);
            changeAcc.WithDraw(100);
            myBank.AddAccount(changeAcc);
        }

        Console.WriteLine();
        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }
    }
开发者ID:kalinnikol,项目名称:TelerikAcademy-1,代码行数:31,代码来源:Program.cs

示例3: Main

        // Write a program to model the bank system by classes and interfaces.
        // Identify the classes, interfaces, base classes and abstract actions
        // and implement the calculation of the interest functionality through overridden methods.
        private static void Main()
        {
            Client client1 = new ClientIndividual("Neo");
            Client client2 = new ClientCompany("Office 1");
            Client client3 = new ClientIndividual("Nakov");

            Account acc1 = new DepositAccount(client1, 5, "BG13TLRK01");
            Account acc2 = new LoanAccount(client2, 4.5m, "BG13TLRK02");
            Account acc3 = new MortgageAccount(client3, 8.8m, "BG13TLRK03");

            acc1.DepositMoney(1000);
            ((DepositAccount)acc1).WithdrawMoney(500);
            acc2.DepositMoney(10000);

            Bank bank = new Bank("New Bank");

            bank.AddAccount(acc1);
            bank.AddAccount(acc2);
            bank.AddAccount(acc3);

            Console.WriteLine(bank.Accounts);

            Console.WriteLine();
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc1.IBAN, acc1.Owner.Name, acc1.CalculateInterest(5));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc2.IBAN, acc2.Owner.Name, acc2.CalculateInterest(6));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc3.IBAN, acc3.Owner.Name, acc3.CalculateInterest(18));

            Console.WriteLine("\nRemoving account 1");
            bank.RemoveAccount(acc1);
            Console.WriteLine(bank.Accounts);
        }
开发者ID:MarKamenov,项目名称:TelerikAcademy,代码行数:34,代码来源:Program.cs

示例4: TestBankRemoveInvalidAccount

 public void TestBankRemoveInvalidAccount()
 {
     Bank bank = new Bank();
     Account acc = new Account();
     bank.AddAccount(acc);
     Account anotherAcc = new Account();
     bank.RemoveAccount(anotherAcc);
 }
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:8,代码来源:BankTest.cs

示例5: TestBankAddRemoveAccount

 public void TestBankAddRemoveAccount()
 {
     Bank bank = new Bank();
     Account acc = new Account();
     bank.AddAccount(acc);
     Assert.AreEqual(bank.AccountsCount, 1);
     bank.RemoveAccount(acc);
     Assert.AreEqual(bank.AccountsCount, 0);
 }
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:9,代码来源:BankTest.cs

示例6: TestBankRemoveNullAccount

 public void TestBankRemoveNullAccount()
 {
     Bank bank = new Bank();
     bank.RemoveAccount(null);
 }
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:5,代码来源:BankTest.cs


注:本文中的Bank.RemoveAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。