Determine whether a given credit card number is valid or not

Assignment Help Management Information Sys
Reference no: EM131323999

Question

Credit card numbers follow certain patterns. A credit card number must have between 13 and 16 digits. It must start with 4 for Visa cards, 5 for Master cards, 37 for American Express cards, and 6 for Discover cards. In 1954, Hans Luhn of IBM proposed the following algorithm for validating credit card numbers:

a. Double every second digit from right to left (e.g., if number is 3 => 3 * 2 => 6) and add them together.

b. If this doubling results in a two-digit number, then add the two digits to get a single-digit number (e.g., if number is 5 => 5 * 2 => 10 => 1+0 => 1).

So, for the credit card number 4388576018402626, doubling all second digits from the right results in (2 * 2 = 4) + (2 * 2 = 4) + (4 * 2 = 8) + (1 * 2 = 2) + (6 * 2 = 12 = 1 + 2 = 3) + (5 * 2 = 10 = 1 + 0 = 1) + (8 * 2 = 16 = 1 + 6 = 7) + (4 * 2 = 8).

This totals to 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37. Add all digits in the odd places from right to left.

The leftmost digit of the credit card number is at index 0; 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38.

Add results from steps (a) and (b) and see if divisible by 10. If it is, then the card number is valid; otherwise invalid. 37 + 38 = 75 is not divisible by 10, so it is an invalid credit card number.

Implement Luhn's algorithm in a program to determine whether a given credit card number is valid or not. You must test if the number of digits in the input is in the valid range (13 to 16), run Luhn's algorithm to test its validity, and if it is valid, print the name of the company that offers that credit card number.

Reference no: EM131323999

Questions Cloud

Write a c program that request the name of cartoon character : Write a C program that requests the name of any cartoon character from the user, then does the following with that name (use printf for each): a. Displays it enclosed in double quotes.
What is the speed and velocity of a car : What is the speed and velocity of a car that travels 32 meters to the east and 12 meters in the same direction? the total time of travel in 3.0 seconds
What is the projected amount of fixed costs : A company is considering a project with a cash break-even point of 31,422 units. The selling price is $39 a unit, the variable cost per unit is $27, and depreciation is $14,000. What is the projected amount of fixed costs?
What is the company cost of capital and equity beta : The company ROC has been financing its operations with equity only. That is, it is fully financed with equity. The expected return on their equity is currently 8%, the share price is $20 per share, and there are 25 million shares outstanding. What is..
Determine whether a given credit card number is valid or not : Implement Luhn's algorithm in a program to determine whether a given credit card number is valid or not. You must test if the number of digits in the input is in the valid range (13 to 16).
Create semi-annual operating budget : The Miami Art Museum (MAM) is working on the budgets for the 2008 fiscal year, which runs from January 1 through December 31. During the first half of FY08 MAM expects its revenues and expenses to be relatively the same as the 2007 fiscal year; Creat..
Discuss how each competency and condition leads : Discuss how each competency and condition leads to either task and/or personal connection by contributing to goal clarity, loyalty, trust, or information sharing -  Explain your reasons with reference to the background materials and examples from t..
What is the process associated with becoming certified : What is the process associated with becoming certified? What is the estimated amount of time necessary to prepare for the certification exam? What requirements are associated with the certification?
Calculate the predetermined overhead rate : ACC00146 - Management Accounting Assignment. Estimated or budgeted cost and operating data for three companies for 2013 are given below: Calculate the predetermined overhead rate to be used in each company during 2013

Reviews

Write a Review

Management Information Sys Questions & Answers

  Find the corresponding encryption key

Consider the following letter encodings:letter A E I M O R T Vencoding 000 001 010 011 100 101 110 111A message M = MARIO is Vernam encrypted into ciphertext C =AOAMV ; C = M © K where © shows modulo 2 XOR operation. Find the corresponding encrypt..

  Discuss the different kinds of mobile and wearable devices

The team should get together and discuss the different kinds of mobile and wearable devices (at least two, preferably three or more), research the features and functionality of them, and compare them based on five criteria.

  Identify the challenge areas

The options should provide sufficient detail so that Brian can decide what to do. Information from Part A should be used as background (input) into the go-forwardoptions outlined in your report.

  Widespread implementation of electronic health records

Determine a key factor that has delayed the widespread implementation of electronic health records in health care organizations. Provide an example of the effects of each factor to support your rationale

  Define the security strategies of defense

Network Security Paper: In this paper, you will define the security strategies of Defense in Depth and Layered Security along with comparing and contrasting the strategies by explaining, at least, two advantages and disadvantages of implementing e..

  Analysis of a company that is highly innovative

Explain how globalization of markets affects the importance of innovation? What are some of the things that influence organizational creativity? Are inventors born or made?

  Summarize the complexities of information technology

Suggest at least two (2) data storage methods regarding database, data warehouse, and / or date mart for your chosen company or industry. Provide a rationale for your response. Determine the optimal data storage method between the methods that you ..

  Rate the importance of critical success factors

Rate the importance of critical success factors (CSF's) to successful ERP implementation in the order of most important to least important.

  Supply management chains

Supply Management Chains - Explain possible situations where leagility has maximum benefit for the organization.

  Create a split form to show all the product information

Project Description: Wanda Robinson runs a home business selling designer clothing and has started using an Access database to keep her records

  Check how rigid the boundaries of your team are

Team issues: Rigidity and level of boundaries, connections in teams, boundary spanner, use of technology - Check how rigid the boundaries of your team are.

  How did target respond to the data breach

What could have caused this data breach? How did Target respond to the data breach?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd