Assignment 4 due Thursday, February 7 at 11:59pm on Canvas Pair Programming Extra Credit Opportunity (1 pt)
User Profiles Improved (10 pts)
/** * Sorts an ArrayList of User objects alphabetically* according to email address, using the bubbleSort * algorithm * @param users the ArrayList of Users */ public void bubblesort(ArrayList<User> users){}
/** * Searches for a user whose email and password match * those currently stored in the users ArrayList * @param email the email that was input * @param password the password input * @param users the ArrayList storing customers on file * @return the location of the user or -1 if not found */ public int binarySearch(String email, String password, ArrayList<User> users) { return -1; }
Profile p = new Profile();
p.bubbleSort(users);
Sample Output: Welcome! Enter your email address: leaperez@yahoo.com Enter your password: letmein Hi, Leanna Perez! We have the following information on file for you: Name: Leanna Perez Gender: F Phone: (408) 876-5443 Email: leaperez@yahoo.com Alternately: Welcome! Enter your email address: jaylaw@sbcglobal.net Enter your password: 555111jjjlll Sorry! We don't have your account on file. Let's create an account for you! Enter your name: Jennifer Lawrence Enter your gender: F Enter your 10 digit phone number (no spaces or punctuation): 5555555555 Thank you, Jennifer Lawrence! Your account has now been created. Name: Jennifer Lawrence Gender: F Phone: (555) 555-5555 Email: jaylaw@sbcglobal.net Sample accounts.txt Output File: Name: Brad Feinman Gender: M Phone: (831) 202-3443 Email: bradisrad@gmail.com Name: Mohammed Abbas Gender: M Phone: (408) 313-4444 Email: downtown_abbas@yahoo.com Name: Alvin Ngo Gender: M Phone: (408) 925-6677 Email: drngo@hotmail.com Name: Abir Fadel Gender: M Phone: (831) 664-5325 Email: greatabs@comcast.com Name: Ally Gu Gender: O Phone: (408) 925-6776 Email: i_am_ally@comcast.net Name: James Brown Gender: M Phone: (831) 567-8432 Email: jaime.boy.brown@hotmail.com Name: Jung Ahrin Gender: F Phone: (831) 925-7788 Email: jung_ahrin@yahoo.com Name: Jiming Wu Gender: F Phone: (408) 212-3458 Email: jwu@gmail.com Name: Kumari Chakrabarti Gender: F Phone: (408) 666-7777 Email: kukuchakrabarti@hotmail.com Name: Leanna Perez Gender: F Phone: ((40) 8) -765- Email: leaperez@yahoo.com Name: Pedro Martinez Gender: M Phone: (408) 616-2323 Email: pedro2018@sbcglobal.net Name: Stacey Cahill Gender: O Phone: (831) 212-3333 Email: scahill@gmail.com Name: Shakil Smith Gender: M Phone: (408) 212-3333 Email: shakattaq@gmail.com Name: Tamara White Gender: F Phone: (831) 777-8978 Email: tamtastic@gmail.com Name: Xing Li Gender: M Phone: (831) 321-4555 Email: xing.li@sbcglobal.net Name: Xiaohang Yue Gender: M Phone: (831) 899-0033 Email: yue95@yahoo.com |