You are tasked with implementing a Java program CreditCardParser that validates credit card numbers based on predefined criteria. The program should be able to:
- Identify and validate three types of credit cards: AMEX, Mastercard, and Visa, based on their initial digits.
- Validate the format and expiration date of the credit card number input.
- Implement the Luhn algorithm to verify the authenticity of the credit card number.
- Provide methods to both validate a given credit card number string and interactively accept input from the user.
- AMEX: Identified by numbers starting with
1121. - Mastercard: Identified by numbers starting with
1111. - Visa: Identified by numbers starting with
3796.
- The credit card number must be in the format
xxxx-xxxx-xxxx-xxxx, where eachxrepresents a digit. - The expiration date of the card (extracted from the input) should be validated to ensure it is not expired.
- Only numeric digits (excluding hyphens) should be considered valid.
- The program should print appropriate messages indicating whether a credit card number is valid or invalid based on the criteria.