Programming Homework Help

KC PIN Verifier Personal Identification Numbers & Computer Rolls Programming Exercise

 

Problem One: PIN Verifier

Your task is to write a program to verify personal identification numbers (PINs). The user will enter a PIN, and your program will verify that it meets the requirements. Your program will report either that the pin does meet the requirements or that it does not. If it does not meet the requirements, it will explain why. These are the requirements for a valid pin:

  1. It must be between 5 and 7 digits long, excluding leading 0’s.
  2. It cannot repeat characters in consecutive positions (for example, 16634 would not be a valid pin)
  3. The sum of the last 4 digits of the pin must be a multiple of 4.
  4. The value of n-choose-k, where n is the largest digit and k is the left-most digit, must be an even number. Note that n-choose-k may be calculated as n! / (n-k)!k!

Your program must allow the user to continue entering candidate pins until they enter a -1, at which point the program will remind the user what the compliant pins were and then exit.