Modify this project Network.java
Use a graph to track friend relationships among members of the network.
Add a feature to enable people to see a list of their friends’ friends.
You need to use One graph data structure
You may need all the files from the "Graphs - Directed Weighted" and UndirectedGraph.java
You must not use any java library such as:
import java.util.ArrayList;
import java.util.List;
import.java.util.graph
because You must use your own data structure
The program create a network and ask the user to do below options:
*/
import java.util.Scanner;
public class Network {
MyArrayList profile = new MyArrayList();
public MyArrayList getProfile() {
return profile;
}
public void setProfile(MyArrayList profile) {
this.profile = profile;
}
public static void main(String[] args) {
Network network = new Network();
Scanner sc = new Scanner(System.in);
System.out.println("Welcome to the network");
boolean quit = false;
while (true) {
System.out.println("nPlease select your option" + "n0. Exit" + "n1. Create a new profile"
+ "n2. Modify a profile" + "n3. Delete a profile" + "n4. Search a profile"
+ "n5. Add friend to a profile" + "n6. Remove friend from a profile" + "n7. Update friend list");
String choice = sc.nextLine();
int selection = Integer.parseInt(choice);
switch (selection) {
case 1:// create a profile
System.out.println("Enter your username");
String name = sc.nextLine();
System.out.println("Please enter the status: ");
String status = sc.nextLine();
PersonProfile profile = network.createProfile(name, status);
network.getProfile().add(profile);
System.out.println("Person profile succesfully created");
System.out.println("nProfile details:n" + profile.toString());
break;
case 2:// Update a profile
System.out.println("Enter the username");
network.modifyProfile(sc.nextLine());
break;
case 3:// delete a profile
System.out.println("Enter the profile name");
network.deleteProfile(sc.nextLine());
break;
case 4:// Read or search a profile
System.out.println("Enter the profile name");
PersonProfile s = network.searchProfile(sc.nextLine());
if (s == null)
System.out.println("Non-existing profile");
else
System.out.println("nProfile details:n" + s.toString());
break;
case 5:// add friend to a profile
System.out.println("Enter the profile name you want to add friends");
PersonProfile p = network.searchProfile(sc.nextLine());
if (p == null)
System.out.println("You can't add friends to a non existing profile");
else {
while (true) {
System.out.println("Enter the friend name");
PersonProfile friend = network.searchProfile(sc.nextLine());
if (friend == null)
System.out.println("No such friend profile exist");
else {
p.addFriend(friend);
System.out.println(p.getPersonName() + " profile details:n" + p.toString());
}
System.out.println("Do you wish to add another friend for this profile (y/n)");
if (sc.nextLine().equalsIgnoreCase("n"))
break;
}
}
break;
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme