Advertisement
mmayoub

DiceGame.java

Jan 28th, 2023
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1.  
  2. public class DiceGame {
  3.  
  4.     public static void main(String[] args) {
  5.         Die d1, d2;
  6.         int counter = 0;
  7.  
  8.         d1 = new Die();
  9.         d2 = new Die();
  10.  
  11.         while (!(d1.getNum() == 6 && d2.getNum() == 6)) {
  12.             System.out.println(d1.getNum() + ":" + d2.getNum());
  13.             d1.roll();
  14.             d2.roll();
  15.             counter++;
  16.         }
  17.         System.out.println(d1.getNum() + ":" + d2.getNum());
  18.         System.out.println("counter = " + counter);
  19.     }
  20.  
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement