We'll continue with the Facebook application by enabling the ability to friend and de- friend people through our driver program. In particular, you will need to add four new menu options: friend someone, de-friend someone, list friends, and recommend new friends. Of course, youll need to add new methods to the Facebook class to perform these actions.
The first three of these new functions (friending, de-friending, and listing friends) are similar to the methods we wrote in 03. Third Assignment Binary File I/O - you should first prompt for the username of the FacebookUser doing the action. If there is no user with that username, display an error message. If the user exists, prompt for a password and make sure that what is entered matches the user's password. For friending and defriending, youll also need to prompt for the username of the new or former friend. Again, if there is no user with that username, display an error message, otherwise, call the appropriate method for the FacebookUser object, passing it the object that represents the new/former friend.
How should we go about recommending new friends? We'll take the approach of recommending all of our friends friends and our friends friends friends, and so on. This is a perfect opportunity to use recursion - we can create a getRecommendations method that takes a FacebookUser as an argument. The method should return an ArrayList that contains all of the friends of the FacebookUser that is passed into it plus the result of calling the same getRecommendations method on all of that FacebookUsers friends. Be careful not to add anyone to the list of recommendations if they are already on it that could lead to an infinite loop.
You will be graded according to the following rubric (each item is worth one point):