Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

RollingDice

By: a guest on Apr 5th, 2012  |  syntax: Java  |  size: 0.59 KB  |  hits: 159  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class RollingDice
  2. {
  3. //------------------------------------------------------
  4. // Creates two Die objects and rolls them several times
  5. //------------------------------------------------------
  6.         public static void main (String[] args )
  7.         {
  8.                 Die d1, d2 ;
  9.                 int sum ;
  10.        
  11.                 // Creates two Die objects
  12.                 d1 = new Die() ;
  13.                 d2 = new Die() ;
  14.                
  15.                 d1.roll() ;
  16.                 d2.roll() ;
  17.                
  18.                 System.out.println ( " Die One: " + d1 + " , Die Two: " + d2 ) ;
  19.                
  20.                 sum = d1.getFaceValue() + d2.getFaceValue();
  21.                 System.out.println ( " Sum: " + sum ) ;
  22.  
  23.    }// end main
  24. }// end class RollingDice