Advertisement
rutera

mathrandom /zarove/

Oct 19th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. import java.util.*;
  2. public class mathrandom {
  3.     protected static Scanner sc = new Scanner(System.in);
  4.    
  5.     public static void main(String[] arg) {
  6.    
  7.        
  8.    
  9.         System.out.println("Would you like to throw the dice?" +
  10.                 "\n1.Yes, please\n2.No thanks");
  11.    
  12.     int    dice = sc.nextInt();
  13.  
  14.     if(dice == 1) {
  15.     int nr;
  16.     nr = (int)(Math.random()*6+1);
  17.    
  18.     System.out.println("You got number "+nr);
  19.     }
  20.    
  21.     else if(dice == 2){
  22.    
  23.     System.out.println("What ever ");
  24.    
  25.         }
  26.     else {
  27.         System.exit(0);
  28.     }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement