I have a problem with Payroll program I want to input only a alphabet for the name , if the
user's input a number, for example, "sam4pl3" or "123 " the program will show a message "Number is not allowed" although the string is alphanumeric, then ask the user to input again, i
thanks in advance.
public static void main(String[] args) { Scanner dataIn = new Scanner(System.in); String firstName; String middleName; String lastName; //NAME System.out.print("Employees First Name: "); firstName = dataIn.nextLine(); //input first name System.out.print("Employees Middle Name: "); middleName = dataIn.nextLine(); //input middle name System.out.print("Employees Last Name: "); lastName = dataIn.nextLine(); //input last name Sample OUTPUT: Employees First Name: Juan 4 you Numbers are not allowed! Employees First Name: Juan Employees Middle Name: 143 Numbers are not allowed! Employees Middle Name: 54 Numbers are not allowed!