using System; /// /// A specialization of BankAccount. /// public class LotteryAccount: BankAccount { private static Lottery lottery = Lottery.Instance(20); /// Construct a lottery account based on /// owner o and the initial balance b /// The owner of the account /// The initial balance of the account public LotteryAccount(string o, decimal b): base(o, b, 0.0) { } /// Add interest to the lottery account. /// This may be a lot if a drawn lottery number is /// the winning number. If not, zero interest is added. /// public override void AddInterests() { int luckyNumber = lottery.DrawLotteryNumber; balance = balance + lottery.AmountWon(luckyNumber); } /// /// Return a text string that represents this account /// for output purposes /// public override string ToString() { return owner + "'s lottery account holds " + + balance + " kroner"; } }