public class MarbleJar
extends java.lang.Object
Constructor and Description |
---|
MarbleJar(int black,
int white)
This constructs the marble jar initializing it with the number of colors
specified by the parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
addMarble(java.lang.String marble)
This method simulates adding a new marble to the jar.
|
java.lang.String |
drawMarble()
This method simulates drawing one marble.
|
boolean |
isEmpty()
This tests if the jar is empty.
|
static void |
main(java.lang.String[] args) |
public MarbleJar(int black, int white)
black
- The number of black marbles.white
- The number of white marbles.public java.lang.String drawMarble()
public void addMarble(java.lang.String marble)
marble
- This string specifies the color of the marble added to the jar. It
must be either "black" or "white".public boolean isEmpty()
public static void main(java.lang.String[] args)