title: how to make a method print out the amount of times a specific number was rolled?
body: <p>i have to make a dice program. the program asks how many times you want to roll the dice, and then it asks what number you want the statistics for (2-12). it then rolls the dice (x) amount of times and gives you the number rolled each time. then it'll tell you the amount of times each number (2-12) was rolled, and it's supposed to finish with the program telling you what the percentage of the number you asked to see statistics for (example: of the 25 dice rolls, 2 rolls added to a total of 10. the percentage of 10s rolled is 8%).</p>
  
  <p>i have to use methods for this program, and my statistics method prints 1 instead of however many times 7 shows up (i'm using 7 as a sort of tester for what i'm doing since 7 is supposed to pop up a lot during dice rolls).</p>
  
  <p>i'm using drjava and i'm not supposed to be using a debugger for my programs since our instructor hasn't taught us how to do it yet! i think my loop is the problem because i'm trying to get d to print.</p>
  
  <p>also, how would i find the percentage of times that my selected number was rolled? </p>
  
  <pre><code>import java.util.*; 
  public class EZD_diceRoll
   {
    public static void main(String args[])
  {
  
  
  
    EZD_diceRoll.roll();
    EZD_diceRoll.statistics(d);
  }
  
   private static int die1;
   private static int die2;
   private static int total;
   public static int number;
   public static int d;
   public static int times;
  
   public static void roll()
   {
    Random nums = new Random();
    Scanner kbReader = new Scanner(System.in);
  
    System.out.print("How many times would you like to roll?");
    times = kbReader.nextInt();
    System.out.print("What number (dice roll total) do you want the statistics 
    for (2 - 12)?");
    number = kbReader.nextInt();
  
  
    for(int a = 1; a &lt; times + 1; a++)
   {
    die1 = 1 + nums.nextInt(6);
    die2 = 1 + nums.nextInt(6);
    total = die1 + die2;
  
    System.out.println("Dice roll #" + a + " is " + total);
   }
  }
  
  
  public static void statistics(int d)
  {
  
    for(int c = 0; c &lt; times + 1; c++)
      {
  
      if(total == 7)
        {
          d++;
        }
      }
    System.out.println("The number of 7's thrown was " + d);
   }
  }
  </code></pre>