I'm trying to make a log in screen which has 10 buttons 0-10 and only accepts 4 digits. I have stored some variables called PIN0-PIN03 which holds a int value. I want the user to enter 4 digit pin and if it matches the values stored in the variables PIN0-PIN03 a name will appear.
I have done the button and everything I just need help with this ENTER button
the code I used for the ENTER button is:
int pin = 0000;
int PIN0 = 1234; // if user enters this value the program will start executing the if statments.
int PIN1 = 2345;
int PIN2 = 3456;
int PIN3 = 4567;\\
if (pin == PIN0){
System.out.println("Hi Muhannad");
if (pin == PIN0){ // if user enters PIN0 it will display the below message
System.out.println("Hi Muhannad");
}
if( pin == PIN1){
System.out.println("Hi Mo");
}
if( pin == PIN2){
System.out.println("Hi Mahir");
}
if( pin == PIN3){
System.out.println("Hi Gawi");
}
if(pin != PIN0 || pin == PIN1 || pin != PIN2 || pin != PIN3){
System.out.println("Incorrect pin try again!"); // if user enters anything that doesn't match any of the variables values the "Incorrect pin try again" will apear.
}
I'm I doing this right?
please help this is a project I started in my own time to create an app similar to banking apps.