Checks to see if the cc number is a valid Diners Club number @param cc - a string representing a credit card number; Sample number: 30000000000004(14 digits) @return true, if the credit card number is a valid Diner's Club number, false otherwise
(String cc)
| 943 | * @return true, if the credit card number is a valid Diner's Club number, false otherwise |
| 944 | */ |
| 945 | public static boolean isDinersClub(String cc) { |
| 946 | int firstdig = Integer.parseInt(cc.substring(0, 1)); |
| 947 | int seconddig = Integer.parseInt(cc.substring(1, 2)); |
| 948 | |
| 949 | if ((cc.length() == 14) && (firstdig == 3) && ((seconddig == 0) || (seconddig == 6) || (seconddig == 8))) |
| 950 | return isCreditCard(cc); |
| 951 | return false; |
| 952 | } |
| 953 | |
| 954 | /** Checks to see if the cc number is a valid Carte Blanche number |
| 955 | * @param cc - a string representing a credit card number; Sample number: 30000000000004(14 digits) |
no test coverage detected