using System;
public class BankAccount {
static int nNextAccountNumber = 1000;
int nAccountNumber;
double dBalance;
public BankAccount() : this(0, 0) { }
public BankAccount(double dInitialBalance) :
this(0, dInitialBalance) { }
public BankAccount(int nInitialAccountNumber,
double dInitialBalance) {
if (nInitialAccountNumber <= 0) {
nInitialAccountNumber = ++nNextAccountNumber;
}
nAccountNumber = nInitialAccountNumber;
if (dInitialBalance < 0) {
dInitialBalance = 0;
}
dBalance = dInitialBalance;
}
public string GetString() {
return String.Format("#{0} = {1:N}",
nAccountNumber, dBalance);
}
}