|
@@ -240,65 +240,64 @@ In the laboratory exercise you will write code to calculate the score associated
|
240
|
240
|
There are predefined functions that update the graphical interface. For the application to work properly, each time that your code computes the score that is given for each criteria you should invoke the function to update that particular criteria in the graphical interface. The functions to update the criteria have the following syntax:
|
241
|
241
|
|
242
|
242
|
|
243
|
|
- ```
|
244
|
|
- void setCRITERIA(int count, int score) ;
|
245
|
|
- ```
|
|
243
|
+```
|
|
244
|
+void setCRITERIA(int count, int score) ;
|
|
245
|
+```
|
246
|
246
|
|
247
|
|
- where CRITERIA should be replaced by the criteria that is being evaluated. Observe that the function requires two arguments: the **count** that is the amount of characters that meet the criteria and the **score** that is the calculation that you will implement following the tables presented above. For example,
|
|
247
|
+where CRITERIA should be replaced by the criteria that is being evaluated. Observe that the function requires two arguments: the **count** that is the amount of characters that meet the criteria and the **score** that is the calculation that you will implement following the tables presented above. For example,
|
248
|
248
|
|
249
|
|
- ```
|
250
|
|
- count = pass.length() ;
|
251
|
|
- score = 4 * count ;
|
252
|
|
- setNumberOfCharacters(count, score);
|
253
|
|
- totalScore += score ;
|
254
|
|
-
|
255
|
|
- ```
|
|
249
|
+```
|
|
250
|
+count = pass.length() ;
|
|
251
|
+score = 4 * count ;
|
|
252
|
+setNumberOfCharacters(count, score);
|
|
253
|
+totalScore += score ;
|
|
254
|
+```
|
256
|
255
|
|
257
|
256
|
In the above code `count` contains the number of characters in the password, `score` contains the computation for the score of the criteria for the number of characters, and `setNumberOfCharacters(count, score);` invokes the function to update the corresponding information for the criteria "Number of characters" in the graphical interface.
|
258
|
257
|
|
259
|
258
|
The functions to update the graphical interface are:
|
260
|
|
- ```
|
261
|
|
- // To update the password's length.
|
262
|
|
- void setNumberOfCharacters(int count, int score) ;
|
263
|
|
-
|
264
|
|
- // For adding points
|
|
259
|
+
|
|
260
|
+```
|
|
261
|
+// To update the password's length.
|
|
262
|
+void setNumberOfCharacters(int count, int score) ;
|
265
|
263
|
|
266
|
|
- // To update the uppercase characters.
|
267
|
|
- void setUpperCharacters(int count, int score) ;
|
|
264
|
+// For adding points
|
268
|
265
|
|
269
|
|
- // To update the lowercase characters.
|
270
|
|
- void setLowerCharacters(int count, int score) ;
|
|
266
|
+// To update the uppercase characters.
|
|
267
|
+void setUpperCharacters(int count, int score) ;
|
271
|
268
|
|
272
|
|
- // To update the characters that are digits.
|
273
|
|
- void setDigits(int count, int score) ;
|
|
269
|
+// To update the lowercase characters.
|
|
270
|
+void setLowerCharacters(int count, int score) ;
|
274
|
271
|
|
275
|
|
- // To update the characters that are symbols.
|
276
|
|
- void setSymbols(int count, int score) ;
|
|
272
|
+// To update the characters that are digits.
|
|
273
|
+void setDigits(int count, int score) ;
|
277
|
274
|
|
278
|
|
- // To update the digits or symbols in the middle
|
279
|
|
- void setMiddleDigitsOrSymbols(int count, int score) ;
|
|
275
|
+// To update the characters that are symbols.
|
|
276
|
+void setSymbols(int count, int score) ;
|
280
|
277
|
|
281
|
|
- // To update the criterium of the requisites
|
282
|
|
- void setRequirements(int count, int score) ;
|
|
278
|
+// To update the digits or symbols in the middle
|
|
279
|
+void setMiddleDigitsOrSymbols(int count, int score) ;
|
283
|
280
|
|
284
|
|
- // For subtracting points
|
|
281
|
+// To update the criterium of the requisites
|
|
282
|
+void setRequirements(int count, int score) ;
|
285
|
283
|
|
286
|
|
- // To update the criterium of only letters.
|
287
|
|
- void setLettersOnly(int count, int score) ;
|
|
284
|
+// For subtracting points
|
288
|
285
|
|
289
|
|
- // To update the criterium of only digits.
|
290
|
|
- void setDigitsOnly(int count, int score) ;
|
|
286
|
+// To update the criterium of only letters.
|
|
287
|
+void setLettersOnly(int count, int score) ;
|
291
|
288
|
|
292
|
|
- // To update the criterium of consecutive uppercase letters.
|
293
|
|
- void setConsecutiveUpper(int count, int score) ;
|
|
289
|
+// To update the criterium of only digits.
|
|
290
|
+void setDigitsOnly(int count, int score) ;
|
294
|
291
|
|
295
|
|
- // To update the criterium of consecutive lowercase letters.
|
296
|
|
- void setConsecutiveLower(int count, int score) ;
|
|
292
|
+// To update the criterium of consecutive uppercase letters.
|
|
293
|
+void setConsecutiveUpper(int count, int score) ;
|
297
|
294
|
|
298
|
|
- // To update the criterium of consecutive digits.
|
299
|
|
- void setConsecutiveDigits(int count, int score) ;
|
300
|
|
- ```
|
|
295
|
+// To update the criterium of consecutive lowercase letters.
|
|
296
|
+void setConsecutiveLower(int count, int score) ;
|
301
|
297
|
|
|
298
|
+// To update the criterium of consecutive digits.
|
|
299
|
+void setConsecutiveDigits(int count, int score) ;
|
|
300
|
+```
|
302
|
301
|
|
303
|
302
|
|
304
|
303
|
### Exercise 3 - Compute the score for the criteria and the total score for the password
|