This is a credit card validation feature using the Lhun's Algorthims
-
User inputs a card number in the first function then
-
the second funciton takes the card no
- takes all the numbers at the even number indexes then sum them all up
- takes all the numbers at the odd number indexes and doubles them then takes the double digits ones, splits them then add them together before summing all them up in single digits
- it then sum the sum of numbers from even indexes and the sum of the odd indexes together
- The total sum is then tested using modulus of 10, if the modulus is 0 then card is valid, otherwise it is an invalid credit card .
-
last function it serves as a constructor for the the app and deals with control flow of the app. the we call the function to initiate the app