ANSWER:
GIVEN THAT:
import java.io.*;
import java.util.*;
import java.io.*;
import java.util.*;
class Member {
private String name;
private String currentStatus;
private Member next;
public Member(String n){
name = n;
currentStatus =
"Active";
next = null;
}
String getName(){
return name;
}
String getStatus(){
return currentStatus;
}
public void setStatus(String a){
currentStatus = a;
}
public void setName(String a){
name = a;
}
public void addFriend (String a){
Member m = new
Member(a);
if (next == null){
next =
m;
}
else {
Member
p = next;
while
(p.next != null)
p = p.next;
p.next
= m;
}
}
public void displayFriends (){
if (next == null){
System.out.println("No friends");
}
else {
Member
p = next;
while
(p!= null){
System.out.println(p.getName());
p = p.next;
}
}
}
}
class UserDatabase{
private ArrayList<Member>
list;
public UserDatabase(){
list =
new ArrayList<Member>();
}
public void addMember(){
Scanner sc = new Scanner(System.in);
System.out.println("Enter name:");
String
line = sc.nextLine();
Member
m = new Member(line);
list.add(m);
}
public void removeMember(){
Scanner sc = new Scanner(System.in);
System.out.println("Enter name:");
String
line = sc.nextLine();
int
found = 0;
for
(int i = 0; i < list.size();i++){
if (list.get(i).getName().equals(line)){
list.remove(i);
found = 1;
}
}
if
(found == 0){
System.out.println("Not Found");
}
}
public void searchMember(){
Scanner sc = new Scanner(System.in);
System.out.println("Enter name:");
String
line = sc.nextLine();
int
found = 0;
for
(int i = 0; i < list.size();i++){
if (list.get(i).getName().equals(line)){
System.out.println("Name:" + line);
System.out.println("Status:" + list.get(i).getStatus());
found = 1;
}
}
if
(found == 0){
System.out.println("Not Found");
}
}
public void modifyMember(){
Scanner sc = new Scanner(System.in);
System.out.println("Enter name:");
String
line = sc.nextLine();
int
found = 0;
for
(int i = 0; i < list.size();i++){
if (list.get(i).getName().equals(line)){
System.out.println("Enter new name:");
line = sc.nextLine();
list.get(i).setName(line);
found = 1;
}
}
if
(found == 0){
System.out.println("Not Found");
}
}
public void displayFriends(){
Scanner sc = new Scanner(System.in);
System.out.println("Enter name:");
String
line = sc.nextLine();
int
found = 0;
for
(int i = 0; i < list.size();i++){
if (list.get(i).getName().equals(line)){
list.get(i).displayFriends();
found = 1;
}
}
if
(found == 0){
System.out.println("Not Found");
}
}
}
public class DemoSocial {
public static void main(String[] args){
Scanner sc = new
Scanner(System.in);
UserDatabase db = new
UserDatabase();
while(true){
System.out.println("1.Create a profile");
System.out.println("2.Leave the network");
System.out.println("3.Search Profile");
System.out.println("4.Modify Profile");
System.out.println("5.Display friends list");
System.out.println("6.Exit");
System.out.println("Enter choice:");
int n = Integer.parseInt(sc.nextLine());
if (n == 6)
break;
else if (n == 1)
db.addMember();
else if (n == 2)
db.removeMember();
else if (n == 3)
db.searchMember();
else if (n == 4)
db.modifyMember();
else if (n == 2)
db.displayFriends();
}
}
}
Java program The popular social network Facebook ™ was founded by Mark Zuckerberg and his classmates...
The popular social network Facebook TM was founded by Mark Zuckerberg and his classmates at Harvard University in 2004. At the time, he was a sophomore studying computer science. 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 person's name, an image(extra credit), current status(Online, offline, busy,...), and a list of friends. Your application should allow a user to join the network, leave...
It's important project. I need a help. Will give up vote for helping! Please use Java !!!!! Need clearly written java program code and sample output!!!!!! The popular social network Facebook TM was founded by Mark Zuckerberg and his classmates at Harvard University in 2004. At the time, he was a sophomore studying computer science. 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...
Will facebook be able to have a successful
business model without invading privacy? explain your answer?
could facebook take any measures to make this possible?
BUSINESS PROBLEM-SOLVING CASE Facebook Privacy: Your Life for Sale Facebook has quickly morphed from a small, niche haps most obviously. Facebook allows you to keep in networking site for mostly Ivy League college stu- touch with your friends, relatives, local restaurants, dents into a publicly traded company with a market and, in short, just about...