Question
java code for this problem In this exam, you will analyse virus contact tracing data. This contact tracing data is one-directional, meaning people who have
java code for this problem
In this exam, you will analyse virus contact tracing data. This contact tracing data is one-directional, meaning people who have tested positive for the virus will report the people with which they have had contact. You will load the contact tracing data from a file and create a Graph. The graph will then be used to identify the relationship between the individuals in the data. Each of parts 1 through 4 should be implemented as a method. File Format Each line in the file will be of the form < SickP erson1 >, < Contact1 >, < Contact2 >, ..., < Contactn >. Each line will always begin with exactly one person, followed by one or more other people. For example, lines in the file could be Jonathan, Alice, Bob or Carol, Alice. Implement the following: 1. Read the provided text file and create the graph. In this contact tracing data, no two persons will have the same name. So, if you read a name another time, it refers to the same person. (10 points) 2. Write a method in the Main class to print each persons contact tracing data as follows: (20 points) Sample Output: Bob had contact with: [Mark, Will, Carol, Paul, Leanne] Mark had contact with: [Zach, Philip] Zach had contact with: [Philip] Will had contact with: [Mark, Leanne] Leanne had contact with: [Sarai] Carol had contact with: [Mark, Leanne] Paul had contact with: [Zach] Farley had contact with: [Paul] Larry had contact with: [Mark, Will, Carol, Leanne] 3. Write a method that takes as input a persons name and prints the peoples names with which he had contact sorted in alphabetical order. (10 points) Sample Input: Bob Sample Output: Bob had contact with Carol, Leanne, Mark, Paul, and Will. Sample Input: Philip Sample Output: Philip had no contact with anyone. 1 4. Write a method that takes as input a persons name and prints true if this person is patient zero, otherwise, returns false. A patient zero is a patient that is sick but who did not appear in anyone elses contact list. (10 points) Sample Input: Bob Philip Sample Output: True Philip had no contact with anyone
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