bank-account/inheritance-1/lottery-account.cs - The class LotteryAccount. | Lecture 7 - slide 5 : 40 Program 4 |
using System; public class LotteryAccount: BankAccount { private static Lottery lottery = Lottery.Instance(20); public LotteryAccount(string o, decimal b): base(o, b, 0.0) { } 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"; } }