0
import java.util.Random;
import java.util.Scanner;
import java.util.Timer;



public class RollingDice {
static int interval;
static Timer timer;
//(String[] args)
    public static void main(String[] args) {
        
        Scanner myBet = new Scanner(System.in);
        while (true) {
        System.out.println("How much are you wanting to bet? ");
        String input = myBet.next();
        
        int intInputValue = 0;
        try {
                intInputValue = Integer.parseInt(input);
                break;
        } catch (NumberFormatException ne) {
            System.out.println("This is not a bet ya tard. ");
                                           }
                    }
        int betAmmount = myBet.nextInt();
                    
        System.out.println("you are risking - $" + betAmmount);
        
        
        Random diceFace = new Random();
            int d = diceFace.nextInt(6) + 1;
        
        System.out.println("Rolled a " + d);
        
        Random opDice = new Random();
            int o = opDice.nextInt(6) + 1;
            
        System.out.println("the Op's Rolled a " + o);
        
        if (d < o) {
            System.out.println("Damn you got finessed out of " + "$" + betAmmount );
                   }
        else if (d == o) {
            System.out.println("Tied");
                         }
        else {
            System.out.println("Nice win " + "$" + betAmmount * 2);
             }
        

    }

}

This is what I have so far for a simple dice roll but every time I run it and input a number it doesn't go past the input unless I enter a number in again it doesn't even have to be the same as the first number.Example of it using the 2nd input

0 Answers0