subject
Geography, 25.07.2019 01:30 huangjianhe135

Question 3 (15% of this assignment): (financial: credit card number validation) credit card numbers follow certain patterns: it must have between 13 and 16 digits, and the number must start with: 4 for visa cards 5 for mastercard credit cards 37 for american express cards 6 for discover cards in 1954, hans luhn of ibm proposed an algorithm for validating credit card numbers. the algorithm is useful to determine whether a card number is entered correctly or whether a credit card is scanned correctly by a scanner. credit card numbers are generated following this validity check, commonly known as the luhn check or the mod 10 check, which can be described as follows (for illustration, consider the card number 4388576018402626): 1. double every second digit from right to left. if doubling of a digit results in a twodigit number, add up the two digits to get a single-digit number. 4388576018402626 2 = 4 2 = 4 4* 2 = 8 * 2 = 2 6 * 2 = 12 (1 + 2 = 3) 5* 2 = 10 (1 + 0 = 1) 8 * 2 = 16 (1 + 6 = 7) 4 * 2 = 8 2. now add all single-digit numbers from step 1. 4 + 4 + 8 + 2+ 3+ 1 + 7 + 8 = 37 3. add all digits in the odd places from right to left in the card number. 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 4. sum the results from steps 2 and 3. 37 + 38 = 75 5. if the result from step 4 is divisible by 10, the card number is valid; otherwise, it is invalid. for example, the number 4388576018402626 is invalid, but the number 4388576018410707 is valid. write a program that prompts the user to enter a credit card number as an integer. display whether the number is valid or invalid. design your program to use the following functions: # return true if the card number is valid def isvalid (number): # get the result from step 2 def sumofdouble evenplace (number): # return this number if it is a single digit, otherwise, return # the sum of the two digits def getdigit(number): # return sum of odd place digits in number def sumo foddplace (number):

ansver
Answers: 1

Another question on Geography

question
Geography, 23.06.2019 01:00
Which anatomical feature would you expect to find in the fossil remains of a nocturnal species?
Answers: 3
question
Geography, 23.06.2019 09:00
If u make mistakes on a school trip to knotts like standing up on a ride too early and they ask you not to do it again or and if you do it again you will be escorted out will it go on my student record? yes i know it is a dumb question
Answers: 1
question
Geography, 23.06.2019 10:40
Maria is going to a hiking trip this weekend. she has been busy shopping for the trip. which of these items that she bought are a want for her?
Answers: 3
question
Geography, 23.06.2019 11:00
Which of the following is the main purpose of using an anchored network of booms which funnel debris to a collection area?
Answers: 2
You know the right answer?
Question 3 (15% of this assignment): (financial: credit card number validation) credit card number...
Questions
question
Mathematics, 06.03.2021 01:40
question
Chemistry, 06.03.2021 01:40
question
History, 06.03.2021 01:40
question
Mathematics, 06.03.2021 01:40
question
Mathematics, 06.03.2021 01:40
Questions on the website: 13722363