jakemalis

Untitled

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