Commit d52f961

mo <mo.khan@gmail.com>
2019-06-10 03:30:34
add program profile for Q3
1 parent 77073fa
Changed files (1)
src/Q3/README.md
@@ -37,6 +37,75 @@ and if it is valid, print the name of the company that offers that credit card n
 ```
 
 2. Description of the Code:
+
+The code implements the expected API as per the class diagram provided
+in the assignment. I also included some additional private methods to
+try to increase the readability of the code. The bulk of the logic for
+the `Luhn` algorithm takes place in the `calculateSums` method.
+
+This method reverses the credit card number then loops through each
+character. As it loops through each character it checks to see if the
+current index is even or odd and applys the appropriate summing rules
+for that index.
+
 3. Errors and Warnings:
+
+Length is too short:
+
+```bash
+java -cp target/assignment2*.jar ca.mokhan.comp268.App 3
+Enter credit card #:
+1334
+1334 in invalid
+```
+
+Length is too long:
+
+```bash
+Enter credit card #:
+41111111111111111
+41111111111111111 in invalid
+````
+
+Invalid card type:
+
+```bash
+Enter credit card #:
+1234567890123456
+1234567890123456 in invalid
+```
+
 4. Sample Input and Output:
+
+Valid AMEX card #:
+
+```bash
+Enter credit card #:
+378282246310005
+378282246310005 is offerred by American Express
+```
+
+Valid Discover card #:
+
+```bash
+Enter credit card #:
+6011111111111117
+6011111111111117 is offerred by Discover
+```
+
+Valid MasterCard #:
+
+```bash
+Enter credit card #:
+5555555555554444
+5555555555554444 is offerred by MasterCard
+```
+
+Valid Visa card #:
+
+```bash
+Enter credit card #:
+4012888888881881
+4012888888881881 is offerred by Visa
+```
 5. Discussion: