Advertisement
HughesElite

Untitled

May 3rd, 2021
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1.  
  2.  
  3. import java.util.Scanner;
  4. import java.util.Random;
  5. public class ConfigTestArea
  6. {
  7.     public static void main(String[] args)
  8.     {
  9.         ConfigTestArea Obj = new ConfigTestArea();
  10.         Obj.go();
  11.  
  12.     }
  13.    
  14.     public void go()
  15.     {
  16.         Scanner scan = new Scanner(System.in);
  17.         Random rand = new Random();
  18.         int diceIntA =1;
  19.         int diceIntB =1;
  20.         int diceMinA = 1;
  21.         int diceMinB =1;
  22.         int count = 0;
  23.        
  24.        
  25.  
  26.         System.out.println("How many sides does the first dice have?");
  27.         diceIntA = scan.nextInt();
  28.        
  29.         System.out.println("How many sides does the second dice have?");
  30.         diceIntB = scan.nextInt();
  31.         scan.close();
  32.        
  33.         switch(count)
  34.         {
  35.         case 0:
  36.             int diceRandomA = rand.nextInt((diceIntA - diceMinA) +1) + diceMinA;
  37.             int diceRandomB = rand.nextInt((diceIntB - diceMinB) +1) + diceMinB;
  38.            
  39.             System.out.println("Dice 1 first roll is " + (diceRandomA));
  40.             System.out.println("Dice 2 first roll is " + (diceRandomB));
  41.             count++;
  42.         case 1:
  43.             int diceRandomA1 = rand.nextInt((diceIntA - diceMinA) +1) + diceMinA;
  44.             int diceRandomB1 = rand.nextInt((diceIntB - diceMinB) +1) + diceMinB;
  45.            
  46.             System.out.println("Dice 1 second roll is " + (diceRandomA1));
  47.             System.out.println("Dice 2 second roll is " + (diceRandomB1));
  48.             count++;
  49.         case 2:
  50.             int diceRandomA2 = rand.nextInt((diceIntA - diceMinA) +1) + diceMinA;
  51.             int diceRandomB2 = rand.nextInt((diceIntB - diceMinB) +1) + diceMinB;
  52.            
  53.             System.out.println("Dice 1 third roll is " + (diceRandomA2));
  54.             System.out.println("Dice 2 third roll is " + (diceRandomB2));
  55.             count++;
  56.            
  57.         }
  58.  
  59.     }
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement