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 passcode.
Then the program calls the method "validateCode" to validate the passcode. Method validateCode takes two Strings as parameters: the user input and the valid passcode, 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 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 passcode... try again" and continues the loop.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
