Lottery Class Reference

A class which assists LotteryAccount with the selection of lucky accounts. Encapsulates a secret winning number and the amount won. A singleton class. More...

Collaboration diagram for Lottery:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool WinningNumber (int n)
 Return if n is equal to the winning number.
decimal AmountWon (int luckyNumber)
 Return the encapsulated amount won if luckyNumber is the winning number.

Static Public Member Functions

static Lottery Instance (int difficulty)
 Returns the unique instance of this class.

Properties

int DrawLotteryNumber [get]
 Draw and return a lottery number

Private Member Functions

 Lottery (int difficulty)

Private Attributes

int difficulty
readonly int winningNumber
readonly decimal amountWon

Static Private Attributes

static Random rdm = new Random(unchecked((int)DateTime.Now.Ticks))
static Lottery uniqueInstance = null

Detailed Description

A class which assists LotteryAccount with the selection of lucky accounts. Encapsulates a secret winning number and the amount won. A singleton class.

Definition at line 6 of file lottery.cs.


Constructor & Destructor Documentation

Lottery.Lottery ( int  difficulty  )  [private]

Definition at line 15 of file lottery.cs.

References amountWon, rdm, and winningNumber.

Referenced by Instance().


Member Function Documentation

decimal Lottery.AmountWon ( int  luckyNumber  ) 

Return the encapsulated amount won if luckyNumber is the winning number.

Parameters:
luckyNumber Some integer number

Definition at line 44 of file lottery.cs.

References amountWon, and WinningNumber().

Referenced by LotteryAccount.AddInterests().

Here is the call graph for this function:

static Lottery Lottery.Instance ( int  difficulty  )  [static]

Returns the unique instance of this class.

Parameters:
difficulty A measure of the difficulty of winning.

Definition at line 23 of file lottery.cs.

References Lottery(), and uniqueInstance.

Here is the call graph for this function:

bool Lottery.WinningNumber ( int  n  ) 

Return if n is equal to the winning number.

Definition at line 35 of file lottery.cs.

References winningNumber.

Referenced by AmountWon().


Member Data Documentation

readonly decimal Lottery.amountWon [private]

Definition at line 12 of file lottery.cs.

Referenced by AmountWon(), and Lottery().

int Lottery.difficulty [private]

Definition at line 10 of file lottery.cs.

Random Lottery.rdm = new Random(unchecked((int)DateTime.Now.Ticks)) [static, private]

Definition at line 8 of file lottery.cs.

Referenced by Lottery().

Lottery Lottery.uniqueInstance = null [static, private]

Definition at line 13 of file lottery.cs.

Referenced by Instance().

readonly int Lottery.winningNumber [private]

Definition at line 11 of file lottery.cs.

Referenced by Lottery(), and WinningNumber().


Property Documentation

int Lottery.DrawLotteryNumber [get]

Draw and return a lottery number

Definition at line 30 of file lottery.cs.

Referenced by LotteryAccount.AddInterests().


The documentation for this class was generated from the following file:

Generated on Thu Nov 5 13:38:16 2009 for BankAccounts with inheritance by  doxygen 1.6.1