本文整理汇总了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));
}
示例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));
}
}
示例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);
}
示例4: TestBankRemoveInvalidAccount
public void TestBankRemoveInvalidAccount()
{
Bank bank = new Bank();
Account acc = new Account();
bank.AddAccount(acc);
Account anotherAcc = new Account();
bank.RemoveAccount(anotherAcc);
}
示例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);
}
示例6: TestBankRemoveNullAccount
public void TestBankRemoveNullAccount()
{
Bank bank = new Bank();
bank.RemoveAccount(null);
}