Write a program that implements this algorithm

Assignment Help Basic Computer Science
Reference no: EM131313777

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.

Reference no: EM131313777

Questions Cloud

Obtain the continuity equation for a steady : Apply the law of conservation of mass to an element in a polar coordinate system and obtain the continuity equation for a steady, two-dimensional, incompressible flow.
Advantages and disadvantages of opening labour markets : What are the advantages and disadvantages of opening labour markets on a global scale? 'Finding work through social networks is rational and efficient.' Discuss this statement and then examine what might be the problems for the human resources mana..
When the prey population is above the predator isocline : Consider Predator-Prey Model 1, in the plots of population versus time, what do the peaks in the prey population graph signify?In Predator-Prey Model 1, why are the predator and prey growth curves out of phase?
Management of human capital in the organization : 1. Describe the management of human capital in the organization. 2. Assess how your organization might structure its policies, practices, and or culture to ensure compliance.
Write a program that implements this algorithm : 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.
Research natural event and terrorist event : Research one of the following events: Option 1: Natural event and Option 2: Terrorist event
Differences between these debugger operations : What are nested loops? Give an example where a nested loop is typically used.
Simulate the drawing of a playing card : Give an example of a for loop in which symmetric bounds are more natural. Give an example of a for loop in which asymmetric bounds are more natural.
Create a proposal letter to your potential funding sources : For this discussion, create a sample proposal letter to your potential funding sources. Explain in detail the need for establishing public and private funding and relationship between the two

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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