Question: Write a main program that prompts the user for a pass - code. Then the program calls the method validateCode to validate the pass -

Write a "main" program that prompts the user for a pass-code.
Then the program calls the method "validateCode" to validate the pass-code. Method validateCode takes two Strings as parameters: the user input and the valid pass-code, and compares the two. It returns true for a match and false otherwise.
The program repeats the sequence above until the valid password is entered by the user. Moreover, the program validates that the user input is a string no longer than 10 characters before calling validateCode. If the user input is too long, the program prints " is too long... try again" and continues the loop. If the user input is not too long, the program calls validateCode.
If validateCode returns true, the program stops the loop, prints "Welcome to my Website!", and terminates. If validateCode returns false, the program prints " is not the valid pass-code... try again" and continues the loop.

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 Programming Questions!