I am making a program which asks the user to input a number and ifthat number co
ID: 3613914 • Letter: I
Question
I am making a program which asks the user to input a number and ifthat number corresponds to my integer stored in the final variablethe user is declared a winner. However if they don't win the firsttime l would like them to have two more chances. I am stuck on howto make a loop which gives the user two more chances if they don'tget the number correctly.Here is my code :
import javax.swing.*;
public class luckynumber1
{
public static void main (String []args)
{
final int LUCKY_NUMBER =50;
double i = Double.parseDouble(JOptionPane.showInputDialog(" Enter a lucky number"));
if(LUCKY_NUMBER/i==1)System.out.println("We got a winner");
if(LUCKY_NUMBER/i!=1)System.out.println(" Sorry try again");
}
}