Question: Problem Description: Write a method that validates a user email format. The email format is as follows: username@***.*** To validate the email format: First, you

Problem Description: Write a method that validates a user email format. The email format is as follows: username@***.*** To validate the email format:

First, you need to check whether the email contains @ and . characters in the right order

Second, you need to ensure that the username (i.e., substring before @ character) consists of alphanumeric characters (a-z/A-Z, 0-9) only (i.e., combination of letters and/or digits, NO special characters)

Use the following method header: public static void validateEmailFormat(String email)

For example, validateEmailFormat(moaabdel@iu.edu) will display Correct Email Address and validateEmailFormat(mo-aabdel@iu.edu) will display The username should include only letters and/or digits

Write a test program that prompts the user to enter an email (e.g., kevin@yahoo.com) and call the validateEmailFormat method you created to validate the format of the email entered. The program should display Correct email format for correct emails and appropriate messages otherwise as illustrated in sample runs below: Here are sample runs of the program:

Sample 1: Enter an email account: moaabdeliu.edu @ character is missing

Sample 2: Enter an email account: moaabdel@iuedu . character is missing

Sample 3: Enter an email account: moaabdel.iu@edu @ should appear before . 2

Sample 4: Enter an email account: moaabdel-2017@iu.edu The username should include only letters and/or digits

Sample 5: Enter an email account: moaabdel@iu.edu Correct Email Address

Sample 6: Enter an email account: moaabdel2017@iu.edu Correct Email Address

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!