simple looping problem
This is a seemingly simple problem, but I cannot seem to figure out why the total variable is not summing the two die results.
Any help would be appreciated. Here is the code:
public class Die2 extends Object {
public Die2() {
}
public static void roll(){
for(int i=0; i<=2;i++){
int result=(int)(Math.random()*6)+1;
int total=+result;
if (i!=2)
System.out.println("You rolled: " + result);
else
System.out.println("Total roll is " + total);
}
}
public static void main (String args[]) {
Die2 die=new Die2();
die.roll();
}
}

