/** Problem: You read in an ID number. Each ID number is supposed
  * to be composed of 2 upper case characters, followed by 2 digits
  * for example:  ZH12.
  * Write a method that accepts a string a boolean indicating whether
  the parameter is a valid ID number. */

import java.util.Scanner;

public class CheckIDnum {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    System.out.println("Enter an ID number to check: " );
    String idnum = sc.nextLine();
    if (isValid(idnum))
      System.out.println(idnum  +  " is valid.");
    else
      System.out.println(idnum  +  " is NOT valid.");
  }
  
  public static boolean isValid(String sample) {
    
    if (Character.isUpperCase(sample.charAt(0)) &&
                        Character.isUpperCase(sample.charAt(1))  &&
                        Character.isDigit(sample.charAt(2)) && 
                        Character.isDigit(sample.charAt(3)))
                             return true;
                                          
    return false;
  }
}
/** Lab Assignment:
  * Read in a string that includes spaces.
  * Call a method passing the string as a parameter.
  * The method should return the number of words in the string parameter.
  */









