Draw the appropriate control flow graph of the given pseudocode.Make sure to only use one number for
Question:
Draw the appropriate control flow graph of the given pseudocode.Make sure to only use one number for blocks of code which are all sequential and when the first line is executed, all of those lines are executed. Another tester has tried to number the code, but may not have done it correctly.
- Remember pseudocode is not focused on any particular language; it's only intended to give you an idea of what is done.
- While statement testing would be based upon a specific programming language, the purpose of this assignment is to make sure you understand how to manually trace through code to understand how to think about the code as well as statement coverage.
// count++ is a shorthand notation for count=count+1;
//prompt user for password
1. PRINT("Please enter a password: ");
String password=UserInput(); //user enters password
boolean isSixCharacters=false; //true if has 6 characters, false if doesn't
boolean hasOneUppercase=false; //true if has 1 uppercase character, false if doesn't
boolean hasOneLowercase=false; //true if has 1 lowercase character, false if doesn't
boolean hasOneDigit=false; //true if has 1 digit, false if doesn't
boolean hasSpecial=false; //true if special character, false if doesn't
int count=0;
2. while(count<3){
3. if(password.length()>8)
{
4. isSixCharacters=true;
}
else{
5. isSixCharacters=false;
}
6. char charValue;
int i=0;
7. while(i {
8. charValue=password.charAt(i);
9. if(Character.isUpperCase(charValue))
{
10. hasOneUppercase=true;
}
11. if (Character.isUpperCase(charValue))
{
12. hasOneLowercase=true;
}
13. else if (Character.isDigit(charValue))
{
14. hasOneDigit=true;
}
15. else if(charValue=='!' ||charValue=='#' || charValue=='@' || charValue=='%' || charValue=='(' ||charValue==')' || charValue=='!' || charValue=='$')
{
16. hasSpecial=true;
}
17. i++;
}
//Process complexity requirements
18. if(hasOneUppercase)
19. count++;
20. if(hasOneLowercase)
21. count++;
22. if(hasOneDigit)
23. count++;
24. else if(hasSpecial)
25. count++;
else
26. System.out.println("Error");
27. if(count<3){
28. count=0;
PRINT("Password does not meet requirements.");
PRINT("Please reenter a password: ");
password=UserInput(); //user enters password
}
}
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill