i have done a programme that generates credit card numbers according to the follow conditions for a class assignment that is due tomorrow
The account number is a 12-digit number, for example 660530 10 4067. It is generated as follows:
1. First 6 digits: date of birth of agent (in YYMMDD)
2. 7th, 8th digits: office code (see table 1)
3. 9th – 11th digits: randomly generated digits (each digit is between 0 and 9 and generated with equal probability)
4. The last digit is determined so that the account number satisfies the criterion of the Luhn Test
Luhn Test
1. Take the 1st, 3rd, … and every other odd digits from the right of the account number. Get the sum of these digits and call it s1.
Example: the 1st, 3rd, … digits from the right of the account number 660530 10 4067 are 7, 0, 0, 0, 5, and 6. Thus s1 = 7+0+0+0+5+6 = 18
2. Take the 2nd, 4th, …. and every other even digits from the right of the account number. Multiply each digit by 2. If the product is larger than 9, replace it by adding the two digits, thus forming a sequence of single digits.
Example: the 2nd, 4th, …. digits from the right of the account above are: 6, 4, 1, 3, 0, 6.
Multiplying each by 2 result in: 12, 8, 2, 6, 0, 12
Replace any number in the sequence that is larger than 9 by the sum of the two digits (eg: 12 is replaced by 1+2,), we get: 3, 8, 2, 6, 0, 3.
3. Get the sum of the digits in step 2 and call it s2.
Example: s2 = 3+8+2+6+0+3 = 22
4. s1 + s2 must be a multiple of 10
But i am getting "sub or function not defined"error...i dnt knw where i gone wrong,please help...thanking you in advance.
Bookmarks