0
409views
JAVA EXCEPTION HANDLING

Define a class to store the credit card details such as -card_number, name, expiry_date (MM/YY), CVV_number, card_type (VISA/Maestro/RuPay), and Bank_name. Validate the data values using exception handling. If the credit card number is less than or greater than 16 digits throw an InvalidCardNumber Exception. Name should be in the format "Lastname Firstname". If not throw an InvalidNameFormat Exception. If the name is in valid format, then check to see whether the name is in uppercase. If not throw an InvalidNameCase exception. The CVVnumber should be three digits long and should not begin with zero. If CVVis not in the format then throw an InvalidCVV Exception. If the validity year is greater than 2025 then throw an InvalidDate exception. If all the data is valid, then generateand print the activation code in the following format: four character of the last namein uppercase, three digit code(111 for visa, 222 for Maestro, 333 for RuPay), first three characters of bank namein lowercase.

Please log in to add an answer.