Membership

Anytime you sign up for a website or an email list they have to check that you are or are not already a member. Your information is compared to the information they already have to see if you already exist.

Code Kata Format

We’ve changed the format of the challenges to be more like a code kata. So instead of three levels of varying difficulty there will be one challenge, and a step further, that you can make as difficult as you need based on where you want to place your focus on learning.

The Challenge

For this challenge you’ll start with a list of names. The user will input a name and the code will check the list to see if the user is in the list or not. Check that the first and last name are in the list and that they are the same record.

If the name exists in the list inform the user that they are already on the list. This would then prompt some other process in a larger app. If it does not exist add it to the list of names so that if the user enters it again it will return that it is already on the list.

Name List

First Last
Lindsey Stirling
Tom Petty
Seth Alley
Dave Grohl
Alice Cooper
Steve Turner
Kurt Cobain
Ken Casey
Eddie Vedder

Creating a Test Case

Write a test case before you start your code. Then write just enough code to pass the test. Once you have passing code refactor to pass other test cases.

A Step Further

Going a step further check for common variations of different first names. So if someone enters Thomas Petty then Tom Petty would return positive.

Hint: This may mean storing a separate list of names and their variants.