public class LotterySimulator extends Object
Modifier and Type | Field and Description |
---|---|
private static String |
CLASSNAME
A holder This classes name (used when logging).
|
static String |
CLASSPATH
The VM classpath (used in some methods)..
|
private int |
fives |
private float |
fivesChance |
private long |
fivesPay |
private int |
fivesPlus |
private float |
fivesPlusChance |
private long |
fivesPlusPay |
private int |
fours |
private float |
foursChance |
private long |
foursPay |
private static boolean |
initClass
Class flag signifying if the initUtil method has been called
|
private int |
initialPool |
private static Log |
log_
Gets a Log instance in case any calling classes are using it.
|
private int |
numbers |
private int |
numTicketsSold |
private int |
ones |
private float |
onesChance |
private long |
onesPay |
static short |
OPEN_DIALOG
A constant to specify which dialog to open with the chooseFileDialog.
|
long |
payout |
private int |
pool |
private float |
poolIncrementPercent |
private float |
quiteEarlyRatio |
static short |
SAVE_DIALOG
A constant to specify which dialog to open with the chooseFileDialog.
|
private int |
sixes |
private float |
sixesChance |
private long |
sixesPay |
private boolean |
stopOnBigWin
If a big win, then stop spending more money
|
static String |
SYSTEM_FILE_SEPERATOR
A holder for this clients System File Separator.
|
static String |
SYSTEM_LINE_SEPERATOR
A holder for this clients System line termination separator.
|
private int |
threes |
private float |
threesChance |
private long |
threesPay |
private int |
ticketPrice |
private int |
twos |
private float |
twosChance |
private long |
twosPay |
private int |
twosPlus |
private float |
twosPlusChance |
private long |
twosPlusPay |
static String |
USERDIR
The users pwd ditrectory.
|
static String |
USERHOME
The users home ditrectory.
|
private static boolean |
verbose |
private static boolean |
verbose2 |
Constructor and Description |
---|
LotterySimulator(int numDraws,
int tixPerDraw)
Constructor for the LotterySimulator object
|
Modifier and Type | Method and Description |
---|---|
private void |
calculatePayouts(int currentPool) |
private long |
drawBonusNumber(Vector v1,
int nums)
Draws on more number as the bonus number from 'nums'
numbers and excludes the numbers already drawn and passed in v1.
|
private long |
getNumTicketsSold(int poolSize)
gets the number of tix sold based on the pool size.
|
private void |
initClass()
Inits the log and the payout amounts for the different prize levels.
|
static void |
main(String[] args) |
private int |
matches(Vector<Long> v1,
Vector<Long> v2)
Counts the number of numbers in v1 match the numbers in v2.
|
static String |
printUsage() |
private Vector<Long> |
rollDice(int numDice,
int nums)
Rolls 'numDice' each with 'nums' sides and returns the results in a Vector of Longs.
|
private boolean |
someoneWonTheJackpot() |
public static final String SYSTEM_FILE_SEPERATOR
public static final String SYSTEM_LINE_SEPERATOR
public static final short OPEN_DIALOG
public static final short SAVE_DIALOG
private static boolean verbose
private static boolean verbose2
private static boolean initClass
private boolean stopOnBigWin
private float quiteEarlyRatio
private int ones
private int twos
private int twosPlus
private int threes
private int fours
private int fives
private int fivesPlus
private int sixes
private long onesPay
private long twosPay
private long twosPlusPay
private long threesPay
private long foursPay
private long fivesPay
private long fivesPlusPay
private long sixesPay
private float onesChance
private float twosChance
private float twosPlusChance
private float threesChance
private float foursChance
private float fivesChance
private float fivesPlusChance
private float sixesChance
public long payout
private int numbers
private int initialPool
private int pool
private float poolIncrementPercent
private int numTicketsSold
private int ticketPrice
public LotterySimulator(int numDraws, int tixPerDraw)
numDraws
- is the number of Draws to runtixPerDraw
- is the number of tix purchased per Drawpublic static String printUsage()
private boolean someoneWonTheJackpot()
private long getNumTicketsSold(int poolSize)
private void initClass()
private void calculatePayouts(int currentPool)
private int matches(Vector<Long> v1, Vector<Long> v2)
private long drawBonusNumber(Vector v1, int nums)
v1
- is a vector of numbers to exclude (nums already drawn)nums
- the sample size ... 1-numsWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses