Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SLAccount2Test {
- public static void main(String[] args) {
- Scanner key = new Scanner(System.in);
- System.out.println("Enter username(10-20 characters): ");
- String username = "";
- boolean isValid = true;
- do {
- if (!isValid) {
- System.out.println("Username invalid.");
- }
- username = key.nextLine();
- } while (!(isValid = SecondLifeAccount2.goodUsername(username)));
- System.out.println("Username accepted.");
- System.out.println("Enter password(6-16 characters, 1 uppercase, "
- + "1 lowercase, 1 digit): ");
- String password = "";
- do {
- if (!isValid) {
- System.out.println("Password invalid.");
- }
- password = key.nextLine();
- } while (!(isValid = SecondLifeAccount2.goodPassword(password)));
- System.out.println("Password accepted.");
- System.out.println("Enter date of birth: ");
- int dob;
- do {
- if (!isValid) {
- System.out.println("Date of birth invalid.");
- }
- dob = key.nextInt();
- } while (!(isValid = SecondLifeAccount2.goodDob(dob)));
- System.out.println("Date of birth accepted.");
- System.out.println("Enter secret question: ");
- String secretQuestion = key.next();
- System.out.println("Enter secret answer: ");
- String secretAnswer = key.next();
- SecondLifeAccount2 user1 = new SecondLifeAccount2(username, password,
- dob, secretQuestion, secretAnswer);
- System.out.println("Your account information");
- System.out.println("Username: " + user1.getUsername());
- System.out.println("Password: " + user1.getPassword());
- System.out.println("Date of birth: " + user1.getDob());
- System.out.println("Secret question: " + user1.getSecretQuestion());
- System.out.println("Secret answer: " + user1.getSecretAnswer());
- }
- }
Add Comment
Please, Sign In to add comment