subject

Suppose you type a 14-digit credit card number into a Web site, but mistype one of the digits or inadvertently interchange two adjacent digits. The Web site will perform a validation check that always detects the first type of error and nearly always detects the second type of error. The validation check is as follows:
1) Starting with the leftmost digit, double it and then double every other digit after it. However, if any of the doubled digits is a two-digit number, subtract 9 from it. Then sum these new digits. For instance, if the credit card number is 58667936100244, then the digits considered are 5,6,7,3,1,0,4, their new replacements are 1,3,5,6,2,0,8, and the sum of the replacements is 25.
2) Sum together the remaining seven digits from the credit card number. That is, the digits in the odd-numbered positions. With the credit card number above, we obtain 8 + 6 + 9 + 6 + 0 + 2 + 4 = 35.
3) Add together the two sums. If the result is a multiple of 10, then accept the credit card number. Otherwise, reject it. We accept the credit card number above since 25 + 35 = 60, a multiple of 10. Write a program that performs data validation on a credit card number. One possible outcome (sample data): Enter a credit card number: 58667936100244 The number is valid.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Competent nonverbal communication involves interacting with others in a manner that is appropriate for which of the following? select all that apply. situation task individuals
Answers: 3
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
question
Computers and Technology, 24.06.2019 09:30
What is the definition of digital literacy?
Answers: 1
You know the right answer?
Suppose you type a 14-digit credit card number into a Web site, but mistype one of the digits or ina...
Questions
question
Mathematics, 21.09.2019 06:10
question
History, 21.09.2019 06:10
question
Health, 21.09.2019 06:10
question
Mathematics, 21.09.2019 06:10
Questions on the website: 13722367