Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

my program is a lottery, if you win the whole thing u get $10,000, get 2 numbers

ID: 664534 • Letter: M

Question

my program is a lottery, if you win the whole thing u get $10,000, get 2 numbers u get 3,000, if you get one number u will get 1,000. if you didn't get a number u lost. This what i want to do: for each one i want to ask the user do you want to try again like "You won 10,000./n Do you you want to see if you can win again?"

"You only won 3,000./n Do you you want to see if you can win 10,000?"

"You only won 1,000./n Do you you want to see if you can win 10,000?"

"You didn't win anything./n Do you you want to see if you can win 10,000?"

how can i make that happen.

HERE IS MY PROGRAM

import java.util.*;

public class random2

{

public static void main(String[] args){

Scanner in = new Scanner(System.in);

Scanner keyboard = new Scanner(System.in);

try

{

int lottery= (int)(Math.random()*1000);

System.out.println("Enter your lottery pick (three digits): " );

int guess = in.nextInt();

int lottDigit1=lottery/10;

int lottDigit2=lottery %10;

int lottDigit3=lottery +10;

int guess1= guess/10;

int guess2= guess%10;

int guess3= guess + 10;

char choice = 'Y';

while (choice != 'N'&& choice !='n')

{

System.out.println("The lottery number is " + lottery);

if (guess == lottery)

System.out.println("You won $10,00");

else if (guess3==lottDigit1

&&guess2==lottDigit3

&& guess1 == lottDigit2)

System.out.println("You match all digits: You won $3,000");

else if (guess1==lottDigit1

|| guess1==lottDigit2

|| guess1== lottDigit3

|| guess2 == lottDigit1

|| guess2 == lottDigit2

|| guess2 == lottDigit3

|| guess3 == lottDigit1

|| guess3 == lottDigit2

|| guess3 == lottDigit3)

System.out.println("Match one digit: you win 1,000");

else

System.out.println("HAHA you didnt win!! Since you didn't win do you want to try again? Press Y to continue and N to end:");

choice = keyboard.next().charAt(0);

}

}

catch (Exception e)

{

System.out.println("ERROR");

}

}

}

Explanation / Answer

public static void main(String[] args) { int[] lottery = new int[6]; int randomNum; for (int i = 0; i < 6; i++) { randomNum = (int) (Math.random() * 50); //Random number created here. for (int x = 0; x