Advertisement
Guest User

RollingDice

a guest
Apr 5th, 2012
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement