title: Java Die, Counting Snake Eyes
body: <p>Okay so for university, we have to Create  two Die objects and roll them several times, counting the number of snake eyes that occur.</p>
  
  <p>this is the code I have, I need some help as every time I compile and execute my program, I get a fail on it. I'm not 100% sure where i'm going wrong, and I Don't know entirely whether solutions will help unless you went to my university, but any help is appreciated :) Thanks.</p>
  
  <p>The Fail is - <a href="http://i.imgur.com/ghcOlpP.png" rel="nofollow">http://i.imgur.com/ghcOlpP.png</a></p>
  
  <p>(This is all coded in JPLIDE)</p>
  
  <pre><code>final int ROLLS = 500;
    int num1, num2, count = 0;
  
    Die die1 = new Die();
    Die die2 = new Die();
  
    for (int roll=1; roll &lt;= ROLLS; roll++)
    {num1 = 1;
      num2 = 1;
  
      if (num1 == 1 &amp;&amp; num2 == 1)    // check for snake eyes
        count++;
    }
  
    System.out.println ("Number of rolls: " + ROLLS);
    System.out.println ("Number of snake eyes: " + count);
    System.out.println ("Ratio: " + (float)count / ROLLS);
  }}}
  
  class Die
  {private final int MAX = 6;  // maximum face value
    private int faceValue;  // current value showing on the die
  
    //-----------------------------------------------------------------
    //  Constructor: Sets the initial face value of this die.
    //-----------------------------------------------------------------
    public Die()
    {faceValue = 1;
    }
  
    //-----------------------------------------------------------------
    //  Computes a new face value for this die and returns the result.
    //-----------------------------------------------------------------
    public int roll()
    {faceValue = (int)(Math.random() * MAX) + 1;
      return faceValue;
    }
  
    //-----------------------------------------------------------------
    //  Face value mutator. The face value is not modified if the
    //  specified value is not valid.
    //-----------------------------------------------------------------
    public void setFaceValue (int value)
    {if (value &gt; 0 &amp;&amp; value &lt;= MAX)
      faceValue = value;
    }
  
    //-----------------------------------------------------------------
    //  Face value accessor.
    //-----------------------------------------------------------------
    public int getFaceValue()
    {return faceValue;
    }
  
    //-----------------------------------------------------------------
    //  Returns a string representation of this die.
    //-----------------------------------------------------------------
    public String toString()
    {String result = Integer.toString(faceValue);
      return result;
    }
  }
  </code></pre>