That was very helpful. I took what you said into consideration, and made a lot of changes. With the way you explained it, telling me it's wrong, why its wrong, and how to fix it, I also put a lot of new information into my stash for future programs. So this is what I have now. No errors (I hope!), and everything works. My last question is, I want to stick a "for" loop in there to count how many rolls the user has done. Right now, it's stuck on one.
I was thinking of using
for (int number_of_plays; number_of_plays < 1000; number_of_plays++)
I stuck that right after the roll results, and before the prompt as to whether or not they want to continue, but it jumps from 1 to 1000 in one shot.
Any suggestions for this one?
Thanks again.
Override
package dicegamefinal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("Welcome to Anthony's Die Roll application!");
int number_of_plays = 1;
Scanner input = new Scanner(System.in);
System.out.print("Do you want to roll the die? (1 = yes, 2 = no): ");
int accept = input.nextInt();
while (accept == 1) {
int die1 = (int)(Math.random() * 6);
int die2 = (int)(Math.random() * 6);
if (die1 == 0 || die2 == 0)
die1 = (die1 + 1);
die2 = (die2 + 1);
System.out.println("Roll " + number_of_plays + ":" + " " + die1 + " " + die2);
if (die1 == 1 && die2 == 1)
System.out.println("Snake eyes!");
else if (die1 == 6 && die2 == 6)
System.out.println("Box cars!");
else if (die1 == 2 && die2 == 5)
System.out.println("Craps!");
else if (die1 == 2 && die2 == 2)
System.out.println("Double Dose!");
System.out.print("Do you want to roll again? (1 = yes, 2 = no): ");
accept = input.nextInt();
}
System.out.println(" ");
System.out.println("Thanks for playing!");
System.exit(0);
}
}