OneCompiler

UPI.java

224

/this is verification of 4 digit System.out.print number in between 1000 to 9999
The maximum number of attempts are 3 only after that account is blocked 2515 is a valid PIN number only 4 digit numbers only consider for verifying pin number
/
import java.util*;
class UnsupportedOperationException{
public static void main(string args[])
{
int pin;
int cnt=0;
char op;
Scanner s=new scanner(system.in);
do{
System.out.println("please enter VALID four digit PIN NUMBER");
pin=s.next();
if(pin>=1000 && pin<=9999){
if(pin==2515)
System.out.println("CONGRATULATIONS you are SUCCESSFULY LOGGED IN");
else{
cnt++;
switch(cnt){
case 1:System.out.println("sorry you have 2 more chances");
break;
case 2:System.out.println("already two attempts are over you have one more last attempt otherwise account is blocked");
break;
case 3:System.out.println("sorry you entered 3 attempts with wrong pin code,account is BLOCKED please contact ADMINISTRATOR");
break;
}
}
}
}else if(pin>=0&&pin,=999)
{
System.out.println("you entered less than four digit NUMBER");
}
System.out.println("do you want to continue to enter valid PIN number(y or y)for continue\notherwise press any key");
op=s.next().charAt(0);
if(cnt>=3)
{
System.out.println("this attempt is DECLINED your account is blocked");
}
}while(op=='y'||op=='y');
}
}