Guest User

Untitled

a guest
Jul 3rd, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SLAccount2Test {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner key = new Scanner(System.in);
  8.  
  9. System.out.println("Enter username(10-20 characters): ");
  10. String username = "";
  11. boolean isValid = true;
  12. do {
  13. if (!isValid) {
  14. System.out.println("Username invalid.");
  15. }
  16. username = key.nextLine();
  17. } while (!(isValid = SecondLifeAccount2.goodUsername(username)));
  18. System.out.println("Username accepted.");
  19.  
  20. System.out.println("Enter password(6-16 characters, 1 uppercase, "
  21. + "1 lowercase, 1 digit): ");
  22. String password = "";
  23. do {
  24. if (!isValid) {
  25. System.out.println("Password invalid.");
  26. }
  27. password = key.nextLine();
  28. } while (!(isValid = SecondLifeAccount2.goodPassword(password)));
  29. System.out.println("Password accepted.");
  30.  
  31. System.out.println("Enter date of birth: ");
  32. int dob;
  33. do {
  34. if (!isValid) {
  35. System.out.println("Date of birth invalid.");
  36. }
  37. dob = key.nextInt();
  38. } while (!(isValid = SecondLifeAccount2.goodDob(dob)));
  39. System.out.println("Date of birth accepted.");
  40.  
  41. System.out.println("Enter secret question: ");
  42. String secretQuestion = key.next();
  43. System.out.println("Enter secret answer: ");
  44. String secretAnswer = key.next();
  45.  
  46. SecondLifeAccount2 user1 = new SecondLifeAccount2(username, password,
  47. dob, secretQuestion, secretAnswer);
  48. System.out.println("Your account information");
  49. System.out.println("Username: " + user1.getUsername());
  50. System.out.println("Password: " + user1.getPassword());
  51. System.out.println("Date of birth: " + user1.getDob());
  52. System.out.println("Secret question: " + user1.getSecretQuestion());
  53. System.out.println("Secret answer: " + user1.getSecretAnswer());
  54.  
  55. }
  56.  
  57. }
Add Comment
Please, Sign In to add comment