outprintn currentPerson person has person

Outprintn currentperson person has person

This preview shows page 3 - 5 out of 5 pages.

System.out.print("\n"); currentPerson = HashClass.getValue(usernameInp);//current person has person object that is paired to that username int ID = HashClass.validateKey(usernameInp); if(currentPerson.getPersonID() != ID) { currentPerson = HashClass.hashArray[ID]; } loginUser = currentPerson.getUserName(); //validate user has entered correct password while(!passwordInp.equals(currentPerson.getPassword())) { System.out.println("Incorrect password!"); System.out.print("Enter password: "); passwordInp = userInp.next(); userInp.nextLine(); System.out.print("\n"); } System.out.println(); System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); System.out.println("Thank you for logging in to BookFace!"); System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); } // REGISTERING A NEW USER FOR THE APP else { // else call register to register account System.out.println("Please create an 8 character username: "); usernameInp = userInp.next(); userInp.nextLine(); while(usernameInp.length() != 8) { System.out.print("Please enter a valid 8 character username: "); usernameInp = userInp.next(); userInp.nextLine(); } //Take all nescessary user input to create a new profile System.out.print("Please create a Password: "); passwordInp = userInp.nextLine(); System.out.print("What is your first name?: "); String firstName = userInp.nextLine(); System.out.print("What is your last name?: ");
Image of page 3
String lastName = userInp.nextLine(); System.out.print("Create a small bio to be displayed on your profile: "); String bio = userInp.nextLine(); //create 4 digit user ID using a hash function int personID = 0; personID = HashClass.createKey(usernameInp); //Load all user data into a new Person object Person<Object> tempPerson = new Person<Object>(); tempPerson.setUserName(usernameInp); tempPerson.setPassword(passwordInp); tempPerson.setFirstName(firstName); tempPerson.setLastName(lastName); tempPerson.setBio(bio); //add new person object to the hashtable at the index associated with the created key based on the username HashClass.addToHashTable(personID, tempPerson); //Login for a newly registered account Person<Object> currentPerson = new Person<Object>(); System.out.print("Enter username: "); usernameInp = userInp.next(); userInp.nextLine(); System.out.print("\n"); //validate while(usernameInp.length() != 8) { System.out.println("Invalid Username"); usernameInp = userInp.next(); userInp.nextLine(); } //enter password System.out.print("Enter password: "); passwordInp = userInp.next(); userInp.nextLine();
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 5 pages?

  • Spring '15
  • Delia Garbacea
  • Login, Busy, Victoria Nguyen, Jahnae Reese, Marley Willyoung

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture