Advertisement
KeeganT

Ch6Ex14

Feb 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package ch6ex14;
  2. import java.util.Random;
  3.  
  4. public class Ch6Ex14
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         System.out.println("Dice1\tDice2\tTotal");
  9.         Random generator=new Random();
  10.         int total, dice1, dice2;
  11.         for(int c=0;c<5;c++)
  12.         {
  13.             dice1=generator.nextInt(6)+1;
  14.             dice2=generator.nextInt(6)+1;
  15.             total=dice1+dice2;
  16.             System.out.println(dice1+"\t"+dice2+"\t"+total);
  17.         }
  18.     }  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement