Question: Social Media App Objectives Apply ArrayList and its methods to solve a problem such as a social media application Problem Create a social media app

Social Media App Objectives Apply ArrayList and its methods to solve a problem such as a social media application Problem Create a social media app to connect people. Your social media app allows you to create a list of the people you can follow. Also, you can follow your followers if you want to. The functionality for this app is somewhat similar to the Instagram app. Here is the list I have created. Feel free to be creative by adding more functionalities. Add a follower Unfollow someone Follow someone Search the list of followers Update followers List all the followers Display the number of the followers Display the number of the people following Classes You are required to implement the following classes in the given order 1. User class 2. SociaMedia class 3. Driver class Implement the classes in the given order, compile as you go User class Here is the UML diagram for the User class. User class must implement the comparable interface. The methods in this class are pretty straight forward. The order of implementing the methods is not important. Add an attribute of your choice to the user class. Make sure to add that attribute to the constructor of the user class. User -String first -String last -String username -boolean followBack -add an attribute of your choice (10 points)+User(String first, String last, String username, Boolean followBack)+getFirst() : String User +getLast(): String +getFollow(): Boolean +setFirst(String newFirst): void +setLast(String newLast) : void +toString() : String +follow(): void +unfollow(): void +equals(User other): Boolean +compareTo(User other) : int //compare two user-name // add the getter and the setter method for the attribute you just added Descriptions of the methods in the User class public User (String first, String last, String username, boolean followBack): this constructor initializes the instance variables getFirst(): returns the first name getLast() : returns the last name getFollow(): returns the followBack variable public void setFirst(String first): allows to modify the first name public void setLast(String last): allows to modify the last name public void unfollow(): sets the followBack variable to false public void follow(): sets followBack variable to true public boolean equals(User other) : compares the username to see if two users are the same return this.username.equalsIgnoreCase(other.username) public String toString(): creates a String representing the User object in the following format, this is a sample output User name: TrevorS Name: Trevor Last name: Schlulz You are not following this person public int compareTo(Object o): compares the two users based on their username. You need to use compareTo method from the string class in this method. If two users have the same username, then they are the same people. This method gets Object o so dont forget to type case it to the User object. Refer to the video lectures SocialMedia class SocialMedia -ArrayList app +SocialMedia ()+followBack(String first, String last) : void +follow (Boolean followBackString name, String last, String username) : Boolean +delete(String first, String last): boolean +find(String first, String last) : boolean _getList(): ArrayList +followerNum(): int +followingNum(): int +toString() : String SocialMedia class methods 1. Public SocialMedia() : This constructor instantiates the ArrayList called app 2. followBack(String first, String last): this method goes through the arraylits app and finds the person with the given first and last name, once the person is found, call the method follow from the User class. Here is the code that you can use: String s = first +""+ last; for(int i =0; i < app.size(); i++){ String s1= app.get(i).getFirst()+""+ app.get(i).getLast(); if(s1.equalsIgnoreCase(s1)){ app.get(i).follow(); }}3. Public boolean follow(String name, String last, String username, Boolean followback): This method gets the information for a User, creates a User object and adds it to the proper location in the list to keep the state of the list sorted. Dont add it to the end of the list. Make sure to also check whether or not the User is already in the list using the find method. Refer to the sample program posted on Canvas (PlayList). This method should return a boolean. Returning true means the follower was added, returning false means the follower is already in the list 4. Public boolean delete(String first, String last) : Use sequential search to find the follower in the list and delete it. The first name and the last name of the follower should be passed to this method. This method should return true if the follower is found and deleted, returning false otherwise 5. Public boolean find(String first, String last): Thisn last name and returns true if the person was found. Search the list based on

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 Programming Questions!