Draft
Credit Card Validifier
253Aweson1
Loading description...
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Lack of random test cases.
Java Translation added! :)
JS translation updated.
; ) )
This is another Kata EXACTLY like this one.
The kata is "Credit card issuer checking"
ok
Should be tested better for invalid card numbers as it seems some of them has been already passed.
Tests for MasterCard id must contain ids that starts with 56-59 digits
This comment has been hidden.
inconsistency in what the instructions say the output should be and what the tests require as an output ('master'/'mastercard')
sorry i'll fix that..
Top solution is not cheking if string only have digits. You should make test cases where there's also chars in strings to make more better kata.
Ok.
Make a program that returns the type of a credit card number, if valid.
The five card types you should consider are:
AMEX: starts with 34 or 37 and is 15 digits long.
Discover: starts with 6011 and is 16 digits long.
MasterCard: starts with 51-55 and is 16 digits long.
VISA: starts with 4 and is either 13 or 16 digits long.
Invalid: any other input
Examples:
credit(12345678910) == "Invalid"
credit(4128374839283) == "VISA"
credit(371236473823676) == "AMEX"
credit(6011364837263748) == "Discover"
credit(5318273647283745) == "MasterCard"
Typo: You may have noticed I changed 'Master' to 'MasterCard' in the description. I think this is more accurate but it is really up to you.
Typo: In your description, the example for AMEX is missing a 6 (or any other number) at the end. When I went to do the kata I saw the saw test case with the 6 at the end.
Thank you for the feedback I will be sure to fix that.
JS translation kumited.
more info on how to approve it ( or not )