While this might sound complicated, look at the code and play a game of find the code block by matching method names in the Program method to other methods in our code, for example, find the PasswordGeneratorSettings method. Finally, our Main() method takes the result of our settings variable and tests that the password we get back from other methods meets our requirements (lines 20-35).The settings variable is defined by passing a number of password-related variables (lines 11-16) to the PasswordGeneratorSettings method, for example, whether or not to include uppercase or special characters. Within the Main() method, next we call the PasswordGeneratorSettings method (line 18) to create an object and assign its result to a variable called settings.Next, our Main() method is called when our software runs (line 9).First, we include any code libraries and system resources we need to use (lines 3-5).Numbers 1-4 in the code example describe how our Program method works: The method will need to return the password as a string despite including numbers. We will add options for which password rules we would like to enforce on each request, so these will be parameters in the Program constructor. There also will be a list of characters to randomly choose from to create our password. To meet our password rules and requirements, we will create a single method called Program which will call other methods to build and test our password. 2 identical characters in a row (so 11 is okay but 111 is not allowed).
0 Comments
Leave a Reply. |