📄 createaccount.cs
字号:
using System;
using System.Collections;
using Banking;
// Test harness
class CreateAccount
{
static void Main()
{
// Create two bank accounts. Use Bank.CreateAccount(...) with the same balance and type
// Store the numbers of these two accounts in long variables accNo1 and accNo2
// Create two BankAccount variables, acc1 and acc2.
// Use Bank.GetAccount() to populate them with the two accounts just created
// Compare acc1 and acc2 using the == operator (should be false as the account numbers will be different)
// Compare acc1 and acc2 using the != operator (should be true as the account numbers will be different)
// Create a third BankAccount variable, acc3, and populate it with the account whose
// account number is in accNo1. Use Bank.GetAccount()
// Compare acc1 and acc3 using the == operator (should be true as all the data will be the same)
// Compare acc1 and acc3 using the == operator (should be false)
}
static void Write(BankAccount acc)
{
Console.WriteLine("Account number is {0}", acc.Number());
Console.WriteLine("Account balance is {0}", acc.Balance());
Console.WriteLine("Account type is {0}", acc.Type());
// Print out the transactions (if any)
Console.WriteLine("Transactions");
Queue tranQueue = acc.Transactions();
foreach (BankTransaction tran in tranQueue) {
Console.WriteLine("Date: {0}\tAmount: {1}", tran.When(), tran.Amount());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -