checkValid ( )To check whether user input is valid or not.return: Boolean. True for valid, false for invalid.