Advertisement
HughesElite

Untitled

May 4th, 2021
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.41 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3.  
  4. public class ConfigTestArea
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         ConfigTestArea Obj = new ConfigTestArea();
  9.         Obj.go();
  10.  
  11.     }
  12.    
  13.     public void go()
  14.     {
  15.         Scanner scan = new Scanner(System.in);
  16.         Random rand = new Random();
  17.         int diceOneInt =1;
  18.         int diceTwoInt =1;
  19.        
  20.         System.out.println("How many sides does the first dice have?");
  21.         diceOneInt = scan.nextInt();
  22.        
  23.         System.out.println("How many sides does the second dice have?");
  24.         diceTwoInt = scan.nextInt();
  25.         scan.close();
  26.        
  27.         int diceOneRandomA = rand.nextInt(diceOneInt) +1;
  28.         int diceTwoRandomA = rand.nextInt(diceTwoInt) +1;
  29.         System.out.println("Dice 1 first roll is " + (diceOneRandomA));
  30.         System.out.println("Dice 2 first roll is " + (diceTwoRandomA));
  31.            
  32.         int diceOneRandomB = rand.nextInt(diceOneInt) +1;
  33.         int diceTwoRandomB = rand.nextInt(diceTwoInt) +1;
  34.         System.out.println("Dice 1 first roll is " + (diceOneRandomB));
  35.         System.out.println("Dice 2 first roll is " + (diceTwoRandomB));
  36.        
  37.         int diceOneRandomC = rand.nextInt(diceOneInt) +1;
  38.         int diceTwoRandomC = rand.nextInt(diceTwoInt) +1;
  39.         System.out.println("Dice 1 first roll is " + (diceOneRandomC));
  40.         System.out.println("Dice 2 first roll is " + (diceTwoRandomC));
  41.        
  42.         System.out.println((diceOneRandomA + diceTwoRandomA + diceOneRandomB +
  43.                 diceTwoRandomB + diceOneRandomC + diceTwoRandomC) /6 );
  44.     }
  45.  
  46.        
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement