title: Java Method(DiceProblem)
body: <blockquote>
  <p>Well, the program that follows, when run, will let me ‘roll a pair of dice’ n-times (i.e.
  generate a number between 1 and 6), where n is a positive integer entered. The
  program then outputs the pair of numbers (‘rolled dice’), as well as the sum of the numbers
  (each pair of dice). The pairs of numbers are stored in a 2-dimensional array, and the sum
  of each pair are stored in a single-dimensional array.</p>
  </blockquote>
  <pre><code>import java.util.Scanner;
  import java.util.Random;
  
  public class diceProblem{
  public static void main(String[] args){
      Scanner input = new Scanner(System.in); 
      
      System.out.print(&quot;Enter the amount of times a pair of dice will roll: &quot;);
      int times = input.nextInt(); 
      
      int[][]dicePairs = rollDicePairs(times);
      System.out.println(&quot;The rolled pairs of numbers are: &quot;);
      printDicePairs(dicePairs);
      
      int[][]dicePairsSums = addDicePairs(dicePairs);
      System.out.println(&quot;The sum of each pairs of numbers are: &quot;);
      printDicePairsSums(dicePairsSums);
  }
  
  public static int[][]rollDicePairs(int times){ 
      int[][]dice = new int[times][2];
      Random die = new Random();
      
      for(int x=0;x&lt;times;x++){
          for(int y=0;y&lt;2;y++){
              dice[x][y] = 1+die.nextInt(6);
          }
      }
      return dice;
  }
  
  public static void printDicePairs(int[][]dicePairs){
      for(int[]pair: dicePairs){
          for(int roll: pair){
              System.out.print(roll+&quot; &quot;);
          }
          System.out.println(&quot;&quot;);
      }
  }
  
  public static int[][]addDicePairs(){
      int[]pairSums = new int[dicePairs];
      for(int x=0;x&lt;pairSums.length;x++){
          int sum = 0;
          for(int y=0;y&lt;dicePairs[x].length;y++){
              sum += dicePairs[x][y];
          }
          pairSums[x] = sum;
      }
      return pairSums;
  }
  
  public static void printDicePairsSum(int[]dicePairsSums){
      for(int sum: dicePairsSums){
          System.out.print(sum+&quot; &quot;);
      }
  }
  }
  </code></pre>
  <blockquote>
  <p>The problem is there are too many errors with this program and it doesn't run or output the pairs of number and the sum</p>
  </blockquote>