Saturday, December 17, 2016

Programming Projects for Beginners - Email Validator

We have all filled out forms where your email is requested.  In most advanced forms, as soon as you type your email, in case you made a mistake, the form would indicate that something is wrong.  This program does exactly that.  It checks the input text to ensure it is a valid email address.

Note: If you stumbled upon this post and are wondering what this is about, start here.

Here is the usecase:
- Program asks user for email address
- User enters email address
- Program checks validity and tells user if something is incorrect and asks user for the email address once more

Assume valid email addresses look like this:
'abc' and 'cde' are alphanumeric text of any length (no special characters or spaces though)
'com' is either a two char or three char alpha string

Programming constructs used:
- User input
- String comparison
- Looping
- Conditional statements
- Error handling
- Exception handling

Here is what a sample output would look like:

Happy coding!