How to make an attempt for only 3 times. In my case, when staff got 3 fail attempts(staff id) it would go back to the main screen. : Iam doing voting system for an assignment, 5 classes, votingInterface,votingController,staff,admin,candidates and 3 file.txt (admin, staff,candidate). what i need to do is to modify the code, and allow the staff to enter a password to get voted(which i did) but messy too.If staff fail 3 attempts of staff id,, it would go back to the screen. You can see pretty much in this method below. I am new to Java and I need help pls



 public void manageVote()
    {
    	
        boolean moveOn = false;
       

        
        while(moveOn == false)
      
        { 
  
            
            System.out.print("Please enter your staff ID :");  
            String input = getInput();
          
            theStaff = vc.getStaff(Integer.parseInt(input)); 
        if(theStaff != null)
        	{        
        		String pass = null; 
        		System.out.print("Enter your password");
        		pass=getInput().trim();
        		
        		if((theStaff.getPass()).equals(pass))
        		{ 
        			getStaffVote();
        			//moveOn=true;
        		}
        		else
        		{
        			System.out.println("Incorrect username/password.");
        		}
        		try
        		{
        			if(theStaff.hasVoted() == 1)
                    {
                    	System.out.println("\nYou have voted and cannot vote again\nGood bye...!");
                   		moveOn = true;
                   	}	
                	else if (theStaff.hasVoted() == 0)
                    {
                    	getStaffVote();
                    	moveOn = true;
                   	}
                    else
                    {
                    		System.out.println("There seems to be a problem.  Contact your administrator");
                    }
                }     
           catch(NumberFormatException e)
            {
                 System.out.println("Invalid entry - you must enter a number\nPlease try again");
            }
           catch(NullPointerException e)
             {
                  System.out.println("Error! Staff ID not found.\nPress ENTER to try again or  \"q\" to QUIT :  " );
                     if ("q".equalsIgnoreCase(getInput()))
                     {
                         System.out.println("Good bye!");
                         moveOn = true;
                     }
             }
        	
         }
         System.out.print("going back to voting screen...");
     }
    }
    
    *enter code here*