class BankAccount
{
double balance;
string name;
static double interest;
public BankAccount() : this(1000, “HCI”)
{
}
public BankAccount(double balance, string name)
{
this.balance = balance;
this.name = name;
BankAccount.interest = 0.7; // 0.7%
}
public void Deposit(double amount)
{
balance = balance + amount;
}
public void Withdrawl(double amount)
{
balance = balance – amount;
}
public void Print()
{
Console.WriteLine(“{0}의 계좌 잔고는 {1}”,
name, balance + balance * BankAccount.interest * 0.01);
}
public static void InterestRate(double interest)
{
BankAccount.interest = interest;
}
}
class Program
{
static void Main(string[] args)
{
BankAccount b = new BankAccount(5000, “HCI222222222222”);
b.Print();
b.Deposit(1000);
b.Print();
b.Withdrawl(500);
b.Print();
BankAccount.InterestRate(1.5); // 1.5%
b.Print();
BankAccount b2 = new BankAccount();
b2.Print();
}
}