1
869views
java program code

java program for : 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 CVV number should be three digits long and should not begin with zero. If CVV is 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 generate and print the activation code in the following format: four character of the last name in uppercase, three digit code(111 for visa, 222 for Maestro, 333 for RuPay), first three characters of bank name in lowercase.

Please log in to add an answer.