Write a programme on credit card number check

Assignment Help C/C++ Programming
Reference no: EM13164308

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 43589795, 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. HINTS: look at digitStripper.cpp and try to do this problem by hand for

the second example below before trying to write code.

Example runs (with user input indicated with bold italics):

Please enter 8-digit card number: 43589795

Card is valid.

Please enter 8-digit card number: 43589796

Card is not valid.

 

 

 

Reference no: EM13164308

Questions Cloud

Calculate the minimum number of grams of propane : calculate the minimum number of grams of propane that must be combusted to provide the energy necessary to convert 5.35 of ice at -21.5 to liquid water at 76.0.
What is the name to represent the actual shape : What is the name to represent the Electronic geometry of C2F2 and also how do you draw a diagram of the actual shape? What is the name to represent the actual shape?
Prepare adjusting entry to recognize bad debts : Show the December 31, 20XX balance sheet presentation of the Company's accounts receivable and related accounts for this assumption.
Calculate the mass of propylene glycol : Calculate the mass of propylene glycol that must be added to 0.500 kg of water to reduce the vapor pressure by 4.60 torr at 40 degrees celcius.
Write a programme on credit card number check : Credit Card Number Check. The last digit of a credit card number is the check digit, which protects againsttranscription errors such as an error in a single digit or switching two digits
How many vitamin c molecules are contained in the tablet : vitamin tablet contains 125 mg of vitamin C (C6H8O6). How many vitamin C molecules are contained in the tablet?
State volume of sodium acetate that you added to solution : For your cereal sample, you added the same volume of sodium acetate that you added to your standards and solution unknown. b) You forgot to add hydroxylamine hydrochloride when you prepared the standards
State a rubber balloon was inflated with helium gas : A rubber balloon was inflated with helium gas and floated in the air. The next day, the balloon was somewhat smaller and no longer floated.
Calculate w and delta e when one mole is vaporized : calculate w and delta e when one mole of a liquid is vaporized at its boiling point (80 degrees celscius) and 1.00 atm pressure. Delta H vaporization for the liquid is 30.7 kJ/mol at 80 degrees celscius.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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