| Launch Create Class Import Run Handin |
|
You now have a class, PairOfDice, with no
syntax errors or warnings, but you
still need to test whether the class works as expected.
We need a driver program which uses the class
PairOfDice and which can be executed. I have
written a Java program called PairOfDiceDriver.java
to test our class. You probably do not want to copy the text, so
we will import the file into our project.
The driver program PairOfDiceDriver.java is actually a file
containing a Java class, PairOfDiceDriver with a single
method, main. This class can be run as a stand-alone
program. The program creates two PairOfDice and
rolls both pairs until they each have the same sum. The
program records the result of each roll, then displays how many rolls
were required before both pairs produced the same sum.
PairOfDice. Choose Import






.metadata and
PairOfDice in this example)


| Launch Create Class Import Run Handin |