Hello all, this site was suggested to me by a fellow student and I am hoping to get some help. Have just begun an introduction to Java course and am finding it quite difficult.

In this program I have to roll a dice twice, add up the numbers and report when two ones come up (Snakeyes) and how many rolls it took. I am having trouble with which loop to use and how to count the number of rolls that have been executed before "snakeyes comes up".

Here is what I have done:class SnakeEyes
public static void main(String[] args)
public static int roll()
int total = 0;
int dice1 = (int)(Math.random()*6)+1;
int dice2 = (int)(Math.random()*6)+1;

total = dice1 + dice2;
return total;

for( int count == 0; count++);
if (total==2) break;
while (total != 2);

System.out.println("You have rolled Snake Eyes!");
System.out.println("This took" +count "rolls");


If anyone has any suggestions, that would be great! Thankyou.