MIT 6.S194 | Open Source Software Project Lab  

What to do when you think you are going crazy

You've had that feeling before: it's late, you're debugging a pset, and you're convinced that the only possible reason your code is failing is because neutrinos keep hitting your CPU and flipping bits at exactly the moment you run the program. Each time. The code is perfect! Why is the answer wrong?!

This exercise will help you practice what to do in that situation. It surrounds a credit card processing algorithm called the Lunh Algorithm.

Please debug this credit processing program.

Here are some credit card numbers that should pass the Lunh Check, for your testing:

  • 378282246310005 (American Express)
  • 30569309025904 (Diners Club)
  • 6011111111111117 (Discover)
  • 4111111111111111 (Visa)
  • 5105105105105100 (MasterCard)