import java.util.Scanner;

/**
 * Lets a user create a new, sample UserAccount object.
 *
 * @author Zach Tomaszewski
 * @version 11 Mar 2008
 */
public class UserAccountCreator {

  public static void main(String[] args) {

    //intro
    System.out.print("You are creating an account on the ");
    System.out.print(UserAccount.getDomain());
    System.out.println(" system.");

    //create account object from user input
    System.out.print("Enter your full name: ");
    Scanner input = new Scanner(System.in);
    UserAccount user = new UserAccount(input.nextLine());

    //print details of new account
    System.out.println();
    System.out.println("--- Your new account details ---");
    System.out.println("Full name: " + user.getFullName());
    System.out.println("First name: " + user.getFirstName());
    System.out.println("Last name: " + user.getLastName());
    System.out.println("Initials: " + user.getInitials());
    System.out.println("Username: " + user.getUsername());
    System.out.println("Email address: " + user.getEmailAddress());
    System.out.println("Password: " + user.getPassword());
    System.out.println("Password (reconfirmed): " + user.getPassword());

    //try setting password
    System.out.println();
    System.out.print("Enter new password: ");
    String password = input.nextLine();
    boolean changed = user.setPassword(password);
    if (!changed) {
      System.out.println("Password not changed: \"" + password + "\" is invalid.");
    }else {
      System.out.println("Password changed.");
    }
  }

}
