| using System;
public class LotteryAccount: BankAccount {
// Instance variables of BankAccount are inherited
protected static Lottery lottery = Lottery.Instance(3);
public LotteryAccount(string o, decimal b):
base(o, b, 0.0) {
}
// Method Balance is inherited
// Method Deposit is inherited
// Method Withdraw is inherited
public override void AddInterests() {
int luckyNumber = lottery.DrawLotteryNumber;
balance = balance + lottery.AmountWon(luckyNumber);
}
public override string ToString() {
return owner + "'s lottery account holds " +
+ balance + " kroner";
}
} |