In: Computer Science
For a given password system, calculate the search space for a general user and a lazy user. Suppose only 11 special characters can be input. Program in java.
Input (by the evaluator):
1st line: number of characters
2nd line: numbers allowed [Y/N]? must be included [Y/N]?
3rd line: letters allowed [Y/N]? case sensitive [Y/N]? must be included [Y/N]?
4th line: special character allowed [Y/N]? must be included [Y/N}
Program Approach:
Import essential packages to get a standard I/O.
Define a main class.
Inside a main class characterize a main function.
Inside a main function utilize scanner class to peruse input given by client.
Taking a whole number contribution from client utilizing scanner class.
Declare string and Boolean sort factors.
Allot the Boolean factors to false.
Take first character contributions from client utilizing scanner class object and utilize if explanation to check the information is substantial or not.
Take second character contribution from client utilizing scanner class object and utilize if statement to check the info is substantial or not.
Take third character contribution from client utilizing scanner class object and utilize if statement to check the information is legitimate or not.
Call a function to generatePassword to show the search space for general client as output.
Call a function to generatePassword to show the search space for apathetic client as output.
Characterize a function generatePasswoed. Inside the function declare string variable and allotting the capital letters, announce string variable and doling out the small letters, declare string variable and relegating the exceptional characters, announce string variable and appointing the numbers, string variable to consolidate characters.
Use if statement to:
Check for letters in order when there is no case delicate and consolidate the capital and lower case letters.
Check for letters in order when there is case delicate.
Check for the uncommon characters.
Check for the numbers.
Make an article irregular of Random class to create arbitrary secret key.
Make an exhibit 'secret key' of size n.
Utilizing circle to show the iterative explanations.
Joining the characters for example letters, uncommon characters and numbers to create secret key.
At long last, show the secret key as the yield.
Program
Output