Advertisement
RazorBlade57

DiceRoll Remaster

Nov 29th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. import java.util.Random;
  2. import java.util.Scanner;
  3. public class DiceRoll {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.         int b = 1;
  8.         while (b == 1){
  9.         Scanner keyboard = new Scanner(System.in);
  10.        
  11.         System.out.println("Pick a number from 0 - 10 :: ");
  12.        
  13.         int result = keyboard.nextInt();
  14.        
  15.         double computer = Math.random()* 10;
  16.         int run = (int) computer;
  17.        
  18.         System.out.println("You rolled a " + result);
  19.         System.out.println("The Computer called a " + run);
  20.        
  21.         {
  22.        
  23.  
  24.         if (result == run)
  25.            
  26.         System.out.println("You won!");
  27.        
  28.         else{
  29.        
  30.         System.out.println("You lost, and must play until you win.");
  31.             b = 1;          }
  32.         }
  33.        
  34.        
  35.        
  36.        
  37.         //  1.) 2 3 4
  38.        
  39.         //  2.) 2 5
  40.        
  41.         //  3.) 3 4 5 6 7 8
  42.        
  43.         //  4.) 3
  44.        
  45.         //  5.) 5 7 9
  46.  
  47.     }
  48.  
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement