Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Design and implement an application that maintains the data for a simple social network. Each person in the network should have a profile that contains
Design and implement an application that maintains the data for a simple social network. Each
person in the network should have a profile that contains the persons name, current status, and a
list of friends. Your application should allow a user to join the network, leave the network, create
a profile, modify the profile, and add friends.
Following are the specifications:
Design a class for representing a persons name eg Name with instance variables for firstname
and lastname, one or more constructors, and related getter and setter methods.
Design a class for representing a persons profile eg Profile with instance variables for
persons name eg private Name profileName; status a String and a list of friends profiles
eg private AList friends; You may use a list implementation of your choice eg an
arraybased list or a linked list. See Chapters and
Have one or more constructors and related getter and setter methods.
Have a method for adding a friend eg addFriend to the profile list. This method should
receive the new friends profile as an argument.
Have a method for removing a friend eg removeFriend from the profile list. This
method should receive the friends profile that has to be removed as an argument.
Have a display method that prints the profile name status, and friends
Design a class for managing the profiles on the social network eg ProfileManager Have an
instance variable that refers to a list of all profiles eg private AList allProfiles;
Have a constructor that initializes the profile list to an empty list.
Have a method for adding a profile to the profile list. The profile to be added should be
passed as an argument to this method.
Have a method for removing a profile from the profile list. The profile to be removed
should be passed as an argument to this method.
Have a method for creating a friendship between two profiles. This method should
receive two profiles as arguments. The first profile argument should be added as a
friend to the second profile and viceversa eg by using the addFriend method of the
Profile class
Have a method for ending a friendship between two profiles. This method should receive
two profiles as arguments. The first profile argument should be removed as a friend
from the second profile and viceversa eg by using the removeFriend method of the
Profile class
Have a display method that prints all the profiles eg by using the display method of the
Profile
Design a driver program eg FacebookApp that creates a profile manager, creates profiles,
adds profiles to the profile manager, creates friendships, ends friendships, and removes profiles.
Be sure to display the profiles and profile manager info after making any updates.
A sample output file is attached.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started