touque.ca > Education Commons > Java > Code

Account Validation

An account number is composed of a quad (4 digits) followed by three triplets (3 digits each).

To validate the account number:

  1. For each of the first three components, calculate the sum of the digits.
  2. Extract the right-most digit of each sum.
  3. Total the right-most digits.
  4. Extract the right-most digit of the total.
  5. Check whether the right-most digit of the total equals the last digit of the account number.

touque.ca > Education Commons > Java > Code

[This page last updated 2020-12-23 at 12h11 Toronto local time.]