public class Solution { public static void main(String[] args) { int n1 = (int)(Math.random() * 5 + 1); int n2 = (int)(Math.random() * 5 + 1); diceGame(n1, n2); } public static void diceGame(int n1, int n2) { if(n1 + n2 == 2 || n1 + n2 == 3 || n1 + n2 == 12) { System.out.println("You rolled " + n1 + " + " + n2 + " = " + (n1 + n2)); System.out.println("You win"); } else if(n1 + n2 == 7 || n1 + n2 == 11) { System.out.println("You rolled " + n1 + " + " + n2 + " = " + (n1 + n2)); System.out.println("You lose"); } else { int sum = n1 + n2; System.out.println("You rolled " + n1 + " + " + n2 + " = " + (n1 + n2)); System.out.println("The point is " + (n1 + n2)); int num1; int num2; while(true) { num1 = (int)(Math.random() * 5 + 1); num2 = (int)(Math.random() * 5 + 1); System.out.println("You rolled " + num1 + " + " + num2 + " = " + (num1 + num2)); if(num1 + num2 == 7) { System.out.println("You lose"); break; } else if(num1 + num2 == sum) { System.out.println("You win"); break; } sum = num1 + num2; } } } }