powerball
Class Entry

java.lang.Object
  extended by powerball.Entry

public class Entry
extends java.lang.Object


Field Summary
static int BALLS
           
static int INVALIDTEST
           
 
Constructor Summary
Entry()
          Creates a new instance of Entry - random
Entry(java.lang.String nam)
          Creates a new instance of Entry, random numbers - given location name
Entry(java.lang.String nam, int mon, int[] nums, int pb)
          Creates a new instance of Entry, passed numbers - given location name - assume todays date
Entry(java.lang.String nam, int mon, int day, int yr)
          Creates a new instance of Entry, random numbers - given location name and drawing date
Entry(java.lang.String nam, int mon, int day, int yr, int[] nums, int pb)
          Creates a new instance of Entry, passed numbers - given location name and drawing date
 
Method Summary
 boolean checkEntry(int[] winning, int pb)
          check entry against actual balls - return whether winner
 boolean equals(java.lang.Object obj)
          check if two Entries have same contents - need policy decision - migth want to check to see if all of the numbers are the same - in which could use it to check if a winner.
 void genRandEntry()
          Service method for generating a power ball entry.
 java.util.GregorianCalendar getDrawingDate()
          report drawing date - as GregorianCalendar
 java.lang.String getDrawingDateAsString()
          report drawing date as String
 boolean getHasBeenChecked()
          report whether the entry has been checked against winning numbers
 int getNumBallsMatch()
          report how many balls match - if hasn't been checked - return invalid indicator
 int[] getNumbers()
          report regular numbers - question whether this should be public
 int getPowerball()
          report powerball - - question whether this should be public
 boolean getPowerballMatches()
          report whether entry powerball matches - if hasn't been checked can't be a winner
 java.lang.String getSoldLocation()
          report sold location
 boolean getWinner()
          report whether entry is a winner - if hasn't been checked can't be a winner
 boolean setDrawingDate(int mon, int day, int yr)
          change drawing date - validation needs more work
 boolean setHasBeenChecked(boolean check)
          change whether the entry has been checked
 boolean setHasBeenChecked(boolean check, boolean win)
          change whether the entry has been checked - and whether the entry is a winner
 boolean setNumbers(int[] nums)
          change numbers - question whether this should be public.
 boolean setPowerball(int pb)
          change powerball - question whether this should be public
 boolean setSoldLocation(java.lang.String loc)
          change sold location
 boolean setWinner(boolean win)
          change winner - question - should this mean that the entry has been checked?
 java.lang.String toString()
          return a string representation for the Entry
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BALLS

public static final int BALLS
See Also:
Constant Field Values

INVALIDTEST

public static final int INVALIDTEST
See Also:
Constant Field Values
Constructor Detail

Entry

public Entry()
Creates a new instance of Entry - random


Entry

public Entry(java.lang.String nam)
Creates a new instance of Entry, random numbers - given location name


Entry

public Entry(java.lang.String nam,
             int mon,
             int day,
             int yr)
Creates a new instance of Entry, random numbers - given location name and drawing date


Entry

public Entry(java.lang.String nam,
             int mon,
             int day,
             int yr,
             int[] nums,
             int pb)
Creates a new instance of Entry, passed numbers - given location name and drawing date


Entry

public Entry(java.lang.String nam,
             int mon,
             int[] nums,
             int pb)
Creates a new instance of Entry, passed numbers - given location name - assume todays date

Method Detail

genRandEntry

public void genRandEntry()
Service method for generating a power ball entry. One flaw - doesn't check for duplicate numbers


getSoldLocation

public java.lang.String getSoldLocation()
report sold location


getDrawingDate

public java.util.GregorianCalendar getDrawingDate()
report drawing date - as GregorianCalendar


getDrawingDateAsString

public java.lang.String getDrawingDateAsString()
report drawing date as String


getNumbers

public int[] getNumbers()
report regular numbers - question whether this should be public


getPowerball

public int getPowerball()
report powerball - - question whether this should be public


getHasBeenChecked

public boolean getHasBeenChecked()
report whether the entry has been checked against winning numbers


getWinner

public boolean getWinner()
report whether entry is a winner - if hasn't been checked can't be a winner


getNumBallsMatch

public int getNumBallsMatch()
report how many balls match - if hasn't been checked - return invalid indicator


getPowerballMatches

public boolean getPowerballMatches()
report whether entry powerball matches - if hasn't been checked can't be a winner


setSoldLocation

public boolean setSoldLocation(java.lang.String loc)
change sold location


setDrawingDate

public boolean setDrawingDate(int mon,
                              int day,
                              int yr)
change drawing date - validation needs more work


setNumbers

public boolean setNumbers(int[] nums)
change numbers - question whether this should be public. Really ougth to validate


setPowerball

public boolean setPowerball(int pb)
change powerball - question whether this should be public


setWinner

public boolean setWinner(boolean win)
change winner - question - should this mean that the entry has been checked?


setHasBeenChecked

public boolean setHasBeenChecked(boolean check)
change whether the entry has been checked


setHasBeenChecked

public boolean setHasBeenChecked(boolean check,
                                 boolean win)
change whether the entry has been checked - and whether the entry is a winner


checkEntry

public boolean checkEntry(int[] winning,
                          int pb)
check entry against actual balls - return whether winner


equals

public boolean equals(java.lang.Object obj)
check if two Entries have same contents - need policy decision - migth want to check to see if all of the numbers are the same - in which could use it to check if a winner. But for now, check all contents

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
return a string representation for the Entry

Overrides:
toString in class java.lang.Object