Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Credit card help

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Credit card help

    Can someone help me with this?

    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 digit 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 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 the value of the check digit that would make it valid.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,542
    My Mood
    Grumpy
    Thanks
    0
    Thanked 166 Times in 157 Posts

    Default Re: Credit card help

    What have you done so far?
    Improving the world one idiot at a time!

Similar Threads

  1. Card Game help....
    By macFs89H in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 2nd, 2011, 07:55 AM
  2. Credit Card Problem (While and Switch will be used)
    By odun in forum Object Oriented Programming
    Replies: 3
    Last Post: March 29th, 2011, 12:54 AM
  3. Credit card validator
    By SOK in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 15th, 2010, 03:11 AM
  4. Replies: 8
    Last Post: December 9th, 2009, 03:45 PM
  5. Credit and thrift society application(urgent)
    By 5723 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 3rd, 2009, 02:44 AM