Ok so here it is:
I ask for the numbers picked
Then ask for the numbers that are drawn
Then when I goto so if they match up its telling me that pickOne can not be resolved but I'm using the users' input, what I have I done wrong?
I searched multiple things on sight none seemed to show the same problem. So I'm sorry if I'm not smart on finding the answer if it has been answered. I did search for about 30 min.
Code:
import java.util.Scanner;
import java.util.*;
public class CheckNumber {
public static void main(String[] args){
Scanner userInput = new Scanner(System.in);
int matchOne;
int matchTwo;
int matchThree;
int matchFour;
/*
*
********** THE NUMBERS CHOSEN BY USER **********
*
*/
System.out.println("First number picked: ");
if (userInput.hasNextInt()){
int pickOne = userInput.nextInt();
}
System.out.println("Second number picked: ");
if (userInput.hasNextInt()){
int pickTwo = userInput.nextInt();
}
System.out.println("Third number picked: ");
if (userInput.hasNextInt()){
int pickThree = userInput.nextInt();
}
System.out.println("Fourth number picked: ");
if (userInput.hasNextInt()){
int pickFour = userInput.nextInt();
}
/*
*
********** THE WINNING NUMBERS DRAWN **********
*
*/
System.out.println("First number drawn: ");
if (userInput.hasNextInt()){
int drawnOne = userInput.nextInt();
}
System.out.println("First number drawn: ");
if (userInput.hasNextInt()){
int drawnTwo = userInput.nextInt();
}
System.out.println("First number drawn: ");
if (userInput.hasNextInt()){
int drawnThree = userInput.nextInt();
}
System.out.println("First number drawn: ");
if (userInput.hasNextInt()){
int drawnFour = userInput.nextInt();
}
/*
********** MATCHING NUMBERS **********
*/
Here is the problem:
if (pickOne == drawnOne){
System.out.println(pickOne + " is a match!");
}
}
}