Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.ArrayList;
- public class BFFHelper {
- ArrayList<BestFriends> myBFFs;
- Scanner keyboard = new Scanner(System.in);
- public BFFHelper()
- {
- myBFFs = new ArrayList<BestFriends>();
- }
- /**
- * Menu option to add a best friend to the arraylist
- * Ask for user input via the scanner class and passes the string to the variable
- * Construct object via the user input
- */
- public void addBFF(){
- System.out.println("Enter a First Name: ");
- String firstName = keyboard.next();
- System.out.println("Enter a Last Name: ");
- String lastName = keyboard.next();
- System.out.println("Enter a Nick Name: ");
- String nickName = keyboard.next();
- System.out.println("Enter a phone number");
- String cellPhone = keyboard.next();
- BestFriends aBFF = new BestFriends(firstName, lastName, nickName, cellPhone);
- myBFFs.add(aBFF);
- }
- public void changeABFF()
- {
- System.out.println("Enter a First Name: ");
- String firstName = keyboard.next();
- System.out.println("enter a Last Name: ");
- String lastName = keyboard.next();
- System.out.println("Enter a Nick Name");
- String nickName = keyboard.next();
- System.out.println("Enter a phone number");
- String cellPhone = keyboard.next();
- BestFriends otherFriend = new BestFriends (firstName, lastName, nickName, cellPhone);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement