Question: * TIA JAVA Try/Catch Registration Simulation For this assignment you will create a program that prompts the user to create a name and password. This

* TIA

JAVA Try/Catch Registration Simulation

For this assignment you will create a program that prompts the user to create a name and password. This will be similar to the registration process implemented by applications and websites that utilize a log in system. The program will validate the users input and make sure it meets the context requirements. A Try/Catch system will be used to deal with any invalid input.

The username must be all letter with an allowance for 1 space. No numbers, symbols or other characters are permitted. Use methods from Javas Character class such as isLetter() to parse the users input in a for loop. If an invalid character is found in the input string, throw an exception object from your own custom Exception class.(more on the below)

The password must have at least 1 uppercase, 1 lowercase, 1 number and 1 symbol. It must also be at least 6 characters long. Use Character methods like is UpperCase() and isLetterOrDigit() to verify that this criteria is met. Other useful methods can be found by reading the Java API documentation on java.lang.Character. You may use the same Exception class as above or create a separate one just for handling password exceptions. It can be done either way.

The Exception class(es) will need a Constructor that receives the details for why the exception was thrown. This may include the user's input and the character or index of the character that did not meet the specification. Override the toString() method to return a string with the information in a labeled, professional format. Your program will display this string from the catch blocks.

In main() prompt the user for the name and the password in 2 separate do loops. If an exception is thrown the program will display the error and immediately reprompt the user for the name or password. ------------------------------------------------------------------------------------------------------------------------------- The output may look something like this.

Enter name: Fred Fl0p

Error: User name must contain only letters and up to 1 space. Found : 0

Enter name: Fred Flop Create a password : Pas$word

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!