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, 22.06.2019 06:30
Drastic boundary changes can occur for all of the following reasons except for a. a shift in the way a river flows b. the collapse of a government system c. a conflict between two neighboring groups d. one country's decision to sell land to another country select the best answer from the choices provide
Answers: 3
question
Geography, 22.06.2019 07:10
According to the united nations refugee agency, more than 2/3 of the world's refugees come from just five countries. which country is not on that list? a) turkey b) myanmar c) afghanistan d) south sudan
Answers: 3
question
Geography, 22.06.2019 12:00
Which of the following expressions is equivalent to -1/4y - 2 1/4 + 1/2 (4-2y)? a. -3y + 2b. -3 1/2+4c. -4 1/2y+2d. -4 1/2y+2show ur work
Answers: 3
question
Geography, 22.06.2019 21:00
When you cross a time zone going east what happens to the time
Answers: 1
You know the right answer?
Question 3 (15% of this assignment): (financial: credit card number validation) credit card number...
Questions
question
Mathematics, 10.11.2020 19:40
question
Mathematics, 10.11.2020 19:40
question
Mathematics, 10.11.2020 19:40
Questions on the website: 13722363