Java Data Abstract & Structures

I need to add a diagram for my assignment. You can change my code

Get Help With a similar task to - Java Data Abstract & Structures

Login to view and/or buy answers.. or post an answer
Additional Instructions:

esign 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 the network, create profile, modify the profile, search for other profiles, and add and remove friends. use java · You need to implement CRUD (In computer programming, create, read, update, and delete (CRUD) are the four basic functions): · C= Create: Add profile- Add friends · R= Read: Read the information of a profile - Search for other profiles · U= Update: Update and edit the profile - Update the friend list · D= Delete: Delete a profile - Delete a friend of a profile. · You need to have a class diagram for your program (A simple one is acceptable): Following are my projects. Could you help me add a class diagram for them? You can change the projects. Profile class import java.util.ArrayList; import java.util.List; public class Profile { public Profile(String name) { this.name=name; this.status="Online"; } private String name; private String image; private String status; private List<Profile> friend=new ArrayList<Profile>(); public String getName() { return name; } public void setName(String name) { this.name = name; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public List<Profile> getFriend() { return friend; } public void setFriend(List<Profile> friend) { this.friend = friend; } public void addFriend(Profile profile) { this.friend.add(profile); } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("[name="); builder.append(name); builder.append(", image="); builder.append(image); builder.append(", status="); builder.append(status); builder.append(", friend="); builder.append(friend); builder.append("]"); return builder.toString(); } } Test.java import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Test2 { private static List<Profile> profiles=new ArrayList<Profile>(); public static void main(String[] args) { Scanner scanner=new Scanner(System.in); System.out.println("Please select option: "); System.out.println("1 for Add a new Profile "); System.out.println("2 for Search Profiles "); System.out.println("3 for Update and edit the profile "); System.out.println("4 for Delete a profile "); System.out.println("-1 for quit "); int iProfile=scanner.nextInt(); if(iProfile==-1) { scanner.close(); return; }else if(iProfile==1) { System.out.println("Please enter name for profile :\n"); String name=scanner.next(); if(name!=null && name.trim()!="") { Profile profile=new Profile(name); System.out.println("Please enter profile picture url :"); String profilePicture=scanner.next(); profile.setImage(profilePicture); profiles.add(profile); } main(new String[] {}); }else if(iProfile==2) { System.out.println("Profile at this Network"); for(Profile profile: profiles) { System.out.println(profile); } main(new String[] {}); }else if(iProfile==3) { System.out.println("Please select profile which you want to update: "); for(int i=0; i<profiles.size(); i++) { System.out.println(i+" for "+profiles.get(i)); } System.out.println("-1 for return to main menu"); int uProfile=scanner.nextInt(); if(uProfile==-1) { main(new String[] {}); }else { Profile profile=profiles.get(uProfile); System.out.println("select profile adding friend"); for(int i=0; i<profiles.size(); i++) { System.out.println(i+" for "+profiles.get(i)); } System.out.println("-1 for return to main menu"); int fProfile=scanner.nextInt(); if(fProfile==-1) { main(new String[] {}); }else { profile.addFriend(profiles.get(fProfile)); main(new String[] {}); } } }else if(iProfile==4) { System.out.println("Please select profile whose friend you want to delete"); for(int i=0; i<profiles.size(); i++) { System.out.println(i+" for "+profiles.get(i)); } System.out.println("-1 for return to main menu"); int dProfile=scanner.nextInt(); if(dProfile==-1) { main(new String[] {}); }else { System.out.println("select friend of "+profiles.get(dProfile).getName()+" want to delete"); for(int i=0; i<profiles.get(dProfile).getFriend().size(); i++) { System.out.println(i+" for "+profiles.get(dProfile).getFriend().get(i)); } System.out.println("-1 for return to main menu"); int aProfile=scanner.nextInt(); if(aProfile==-1) { main(new String[] {}); }else { profiles.get(dProfile).getFriend().set(aProfile, null); } } } } }

Related Questions

Similar orders to Java Data Abstract & Structures
5
Views
0
Answers
Creating a DNS server (written in C)
WANT >=50% due to being swamped (only standard option minimal, don't care about cache or non-blocking). I require periodic updates of code with a description as there is a Git commit tracking. Also require a makefile according to the specifications and a g...
20
Views
0
Answers
Create inheritance project for a restaurant
Projects must include: -at least three different levels of inheritance - at least nine classes total -the highest superclass must have at least two methods -every subclass must contain a unique method that was not present in its super...
16
Views
0
Answers
Python Code for Suggesting Pets
Must have ___init___ ; ___str___ ; for loops ; while loops ; and must define a function which returns something, I wrote down what idea I had in that form so its best to follow it, this is an entry-level computer science project so it should be pretty easy...
22
Views
0
Answers
Quick HW Computer Science on LL(1) and object creation
Due at 12:00pm today. The question details are in the files attached. One question is on the impact of a parser being LL(1) or not. Another is on imagining a mistake in object creation. The answers are probably max 2 lines long....