title: Roll two dice java program
body: <p>I need to write a simple java program "Roll the Dice" with special variables: When the user rolls the dice, the application rolls two dice, displays the results of each, and asks if the user wants to roll again. Write a program that has the Main method and a separate method for the random number generator. Create a 4 integer variables to store two dice, sum of the two dice, and one for the number of times the dice are rolled. One string variable to hold the player’s name and a character variable to hold a ‘y’ or ‘n’. I spend an hours to try make it right but nothing really  works. this what I have so far and I can't do more:</p>
  
  <pre><code>import java.util.Random;
  import java.util.Scanner;
  import javax.xml.validation.Validator;
  
  public class Main {
  
  
  
  
  public static void main(String[] args) {
      System.out.println( "Welcome to the Karol’s Roller Application" );
      System.out.println();
  
      Scanner sc = new Scanner(System.in);
      String choice = "y";
  
      choice = Validator.getString(sc, "Roll the Dice? (y/n): ");
  
      while(choice.equalsIgnoreCase("y"))
      {
  
          choice = Validator.getString(sc, "Roll again? (y/n): ");
  
  
          }
      }
  
  
   Random randomNumbers = new Random();{
  
   int dieOne = 0;
   int dieTwo = 0;
   int totals[] = new int[ 13 ];
  
   for( int index = 0; index &lt; totals.length; index++ ) {
   totals[ index ] = 0;
  
   for( int roll = 1; roll &lt;=4; roll++ ) {
      dieOne = (int)(Math.random()*6) + 1;
      dieTwo = (int)(Math.random()*6) + 1;
      totals[ dieOne + dieTwo ]++;}
  
   System.out.println( "Roll 1" +
           "\n " + dieOne + " " + 
           "\n " + dieTwo + " ");
  
  if (totals[ dieOne + dieTwo ] == 7 )
  System.out.println( "Craps!" + "\n" );
  
  else if (totals[ dieOne + dieTwo ] == 2 )
  System.out.println( "Snake eyes!" + "\n" );
  
  else if (totals[ dieOne + dieTwo ] == 12 )
  System.out.println("Box cars!" + "\n");
  
  
  
  
  }
  
     }
  
  }
  </code></pre>
  
  <p>Please, if someone can help me to do correct this program that I have some issue with, the result should look more or less like this: </p>
  
  <pre><code>Welcome to the "name here" Roller Application
  
  Roll the dice? (y/n): y
  
  Roll 1:
  number on dice one
  number on dice two
  
  Roll again? (y/n): y
  
  Roll 2:
  number on dice one
  number on dice two
  
  Roll again? (y/n): y
  
  Roll 3:
  number on dice one
  number on dice two
  
  Roll again? (y/n): y
  
  Roll 4:
  number on dice one
  number on dice two
  </code></pre>