Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Credit Card Number Check. The last digit of a credit card number is the check digit, which protects against transcription errors such as an error in a single digit or switching two digits. The following method is used to verify actual credit card numbers but, for simplicity, we will describe it for numbers with 8 digits instead of 16:

• Starting from the rightmost digit, form the sum of every other digit. For example, if the credit card number is 4358 9795, then you form the sum 5 + 7 + 8 + 3 = 23.

• Double each of the digits that were not included in the preceding step. Add all digits of the resulting numbers. For example, with the number given above, doubling the digits, starting with the next-to-last one, yields 18 18 10 8. Adding all digits in these values yields 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27.

• Add the sums of the two preceding steps. If the last digit of the result is 0, the number is valid. In our case, 23 + 27 = 50, so the number is valid.

Write a program that implements this algorithm. The user should supply an 8-digit number, and you should print out whether the number is valid or not. If it is not valid, you should print out the value of the check digit that would make the number valid.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92068393

Have any Question? 


Related Questions in Computer Engineering

Sql using oraclethe task is to remove suffix from last name

SQL using Oracle. The task is to remove suffix from last name column (e.g. Smith Sr. or Stevens Jr.) and put into the preexisting suffix column in the DB. Final result needs to be in the last name column: Smith or Steven ...

After reading the article 10 techniques for gathering

After reading the article, 10 Techniques for Gathering Business Requirements, think about the following scenario and answer the questions provided. Wilmington University is implementing a mobile app where students are ab ...

Discuss how an enterprise architecture can establish

Discuss how an Enterprise Architecture can establish governance mechanisms?

Make a function last-char that consumes a nonempty string

Make a function last-char that consumes a nonempty string and produces a string consisting of the last character in the original string.

Question based on what you learn from the vignette what do

Question: Based on what you learn from the vignette, what do you think are the relationships between Web analytics, text mining, and sentiment analysis? The response must be typed, single spaced, must be in times new rom ...

1 investment risk and default risk are interchangeable

1. Investment risk and default risk are interchangeable terms and essentially mean the same thing.   2. Disadvantages of the Capital Asset Pricing Model include that you are using the past to predict the future and that ...

Need guidance on a c program that1 asks the user to input a

Need guidance on a C++ program that: 1. Asks the user to input a number of cents 2. Calculates and displays the number of quarters, dimes, nickels, and pennies that should be used to reach the value. EX: 67 cents would b ...

Question 1 describe the components and basic requirements

Question: 1. Describe the components and basic requirements for creating an audit plan for an IT Infrastructure Audit. 2. Using the National Institute of Standards and Technology (NIST) IT security controls, what is incl ...

Question critical infrastructures -1discuss cybersecurity

Question: Critical Infrastructures - 1. Discuss cybersecurity policy issues affecting SCADA and ICS systems for Critical Infrastructure services for the public, and compare those issues to the policy issues that affect t ...

Please discuss the followingas demand increased for these

Please discuss the following: As demand increased for these mortgage backed securities, lenders reacted by relaxing their approval standards to increase production. No longer were "all" borrowers required to document the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As