Advertisement
jakemalis

Untitled

Mar 29th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. import java.util.ArrayList;
  2.  
  3. public class AddressBook
  4. {
  5. private ArrayList<Contact> list;
  6. private String combinedName;
  7. private String combinedArrayName;
  8.  
  9. public AddressBook() {
  10. list = new ArrayList<Contact>();
  11. }
  12.  
  13. public void addContact(String first, String last, String email)
  14. {
  15. String lastName = last.toUpperCase();
  16. String firstName = first.toUpperCase();
  17.  
  18. combinedName = lastName + firstName;
  19.  
  20. for (ArrayList<Contact> list : list) {
  21. combinedArrayName = this.lastName.toUpperCase() + this.first.toUpperCase();
  22. if (combinedName.equals(combinedArrayName)) {
  23. System.out.println("Attepmted to add contact but contact already exists.");
  24. }
  25. else {
  26. System.out.println("Removed");
  27. }
  28. }
  29. }
  30. public void removeContact(String first, String last)
  31. {
  32.  
  33. }
  34. public void mergeBooks(AddressBook otherBook)
  35. {
  36.  
  37. }
  38. public String toString()
  39. {
  40. return "String";
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement