UPI.java
import java.util.*;
class UPIPin
{
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.nextInt();
if(pin>=1000 && pin<=9999){
if(pin==2515)
System.out.println("CONGRATULATIONS you are SUCCESSFULLY 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 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");
}
else
{
System.out.println("You entered more 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');
}
}