Question: I just need help with figuring out how to do this part! Next we will create a subclass of UserAccount called FacebookUser. The FacebookUser class

 I just need help with figuring out how to do this

I just need help with figuring out how to do this part!

Next we will create a subclass of UserAccount called FacebookUser. The FacebookUser class needs to have the following fields and methods in addition to what is in UserAccount: String passwordHint ArrayList friends void setPasswordHint (String hint) void friend (FacebookUser newFriend) void defriend (FacebookUser formerFriend) ArrayList getFriends () The friend method should add the FacebookUser argument to the friends ArrayList (if that FacebookUser is already in the friends list, display an error message), and the defriend method should remove the FacebookUser argument from that ArrayList (if that FacebookUser is not in the friends list, display an error message). The getFriends method should return a copy of this user's friends - create a new ArrayList with the same FacebookUsers in it as this user's friends. Do not return the friends ArrayList directly, since this violates the principle of encapsulation. The getPasswordHelp method should display the passwordHint. The FacebookUser class should also implement the Comparable interface FacebookUsers should be sorted alphabetically by username, ignoring capitalization. (Hint: notice that the toString method returns the username of the UserAccount.) Finally, write a driver program that creates several FacebookUsers and demonstrates the user of the setPasswordHint, friend, defriend, getFriends, and getPasswordHelp methods. Also, put the FacebookUser objects into an ArrayList, sort them (see the jar file for this topic for help on this), and print them out in sorted order

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!