Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.ArrayList;
  3.  
  4. public class BFFHelper {
  5. ArrayList<BestFriends> myBFFs;
  6. Scanner keyboard = new Scanner(System.in);
  7.  
  8. public BFFHelper()
  9. {
  10. myBFFs = new ArrayList<BestFriends>();
  11. }
  12. /**
  13. * Menu option to add a best friend to the arraylist
  14. * Ask for user input via the scanner class and passes the string to the variable
  15. * Construct object via the user input
  16. */
  17. public void addBFF(){
  18. System.out.println("Enter a First Name: ");
  19. String firstName = keyboard.next();
  20. System.out.println("Enter a Last Name: ");
  21. String lastName = keyboard.next();
  22. System.out.println("Enter a Nick Name: ");
  23. String nickName = keyboard.next();
  24. System.out.println("Enter a phone number");
  25. String cellPhone = keyboard.next();
  26.  
  27. BestFriends aBFF = new BestFriends(firstName, lastName, nickName, cellPhone);
  28. myBFFs.add(aBFF);
  29. }
  30.  
  31. public void changeABFF()
  32. {
  33. System.out.println("Enter a First Name: ");
  34. String firstName = keyboard.next();
  35. System.out.println("enter a Last Name: ");
  36. String lastName = keyboard.next();
  37. System.out.println("Enter a Nick Name");
  38. String nickName = keyboard.next();
  39. System.out.println("Enter a phone number");
  40. String cellPhone = keyboard.next();
  41.  
  42. BestFriends otherFriend = new BestFriends (firstName, lastName, nickName, cellPhone);
  43.  
  44.  
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement