ITEC 120 LAB 12 Back to Lab index page

Dice Roller

Use your Die class and write a driver which creates 2 dice and rolls them. Look at the roll and print messages based on the roll:

Next, change the toString() method to return a string which represents a dice graphically, using periods or lowercase os. (Feel free to make yours look even better than the following examples.)

Sample 1

Program displays:

You rolled:

  o

o o o
o o o

Lucky 7!

Sample 2

Program displays:

You rolled:

 o o
 o o

 o o
 o o

Double 4s!