Advertisement
mmayoub

DiceGame, 10.07.2021

Jul 10th, 2021
1,208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. package prj10072021;
  2.  
  3. public class DiceGame {
  4.  
  5.     public static void main(String[] args) {
  6.         Die d1, d2;
  7.         int c;
  8.  
  9.         c = 0;
  10.         d1 = new Die();
  11.         d2 = new Die();
  12.  
  13.         // while (((d1.getNum()!=6) || (d2.getNum()!=6))) {
  14.         while (!((d1.getNum() == 6) && (d2.getNum() == 6))) {
  15.             System.out.println(d1.getNum() + ", " + d2.getNum());
  16.             c++;
  17.  
  18.             d1.roll();
  19.             d2.roll();
  20.         }
  21.  
  22.         System.out.println("You got 6, 6 after " + c + " rolls");
  23.  
  24.     }
  25.  
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement