Advertisement
scaawt

CSCE HW05

Sep 19th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package CSCE145;
  2.  
  3. //written by --
  4.  
  5. import java.util.Random;
  6. import java.util.Scanner;
  7.  
  8. public class Main {
  9.     Random random = new Random();
  10.  
  11.     public static void main(String[] args) {
  12.         Scanner keyboard = new Scanner(System.in);
  13.         System.out.print("Enter the number of times a 6 sided die should be rolled.");
  14.         int die = keyboard.nextInt();
  15.         int a = 0;
  16.         if(die>a){
  17.             for(int i = 0; i<die; i++){
  18.                 int num = (int)(6 * Math.random()+1);
  19.                 System.out.println(num);
  20.             }
  21.         }
  22.         else
  23.             System.out.println("Please enter a positive value");
  24.  
  25.  
  26.  
  27.  
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement