CS 111: Lab 3 main content
Student Learning Objectives
Demonstrate the ability to
- Use the jGRASP programming environment to create a new Java project at
u:\Lab3\ with two Java code files: PasswordVerifier.java and Driver.java.
- Use class (static) methods in class PasswordVerifier.
- Use
String and Character class methods
Lab 3 Assignment
Do Chapter 8, Programming Challenge 5: Password Verifier
- Create a new Java project at
u:\Lab3\.
- Add two Java files to the project:
Driver should contain the main method
PasswordVerifier should contain class (static) methods to check each condition for a valid password
- Password should contain at least six characters
- Password should contain at least one uppercase letter
- Password should contain at least one lowercase letter
- Password should contain at least one digit
- Write the code for the
Driver class to
- Prompt for and read in a user password
- Call a static method in PasswordVerifier to validate the password
- Display whether the password is valid or not
Sample Session
Follow the sample sessions shown below:
Enter a password: aas2ss
Invalid password.
Session 2
Enter a password: aa5SSc
Valid password.
To Receive Credit
- If you finish during Tuesday's lab, ask your TA to come over to check your program and give you credit.
Note: The TA will check your program on your computer. You do not need to print out the source code.
- If you are unable during Tuesday's lab, turn in the printout of
PasswordVerifier.java by the start of class on Wednesday.
Programming Challenge
If you finish early, get yourself checked off first!
As a programming challenge (not required but recommended):
Modify your program so that the
- The user needs to keep entering candidate passwords until they enter a valid one
- The user need to also enter a confirming password that must match the first candidate password