You task is to use linked lists to analyze the spread of the cold virus. Suppose that your program V

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Order a Similar Paper HERE Order a Different Paper HERE

You task is to use linked lists to analyze the spread of the cold virus. Suppose that your program Virus.java reads a number of lines of text, each line containing a pair of names. The first name indicates the person who sneezes or coughs, and the second name indicates the person who is sneezed /coughed on. Assume that the virus is potent enough so that the second person catches the cold immediately. For example, the input to the program could be something like this:

Enter the pair of names (A????1q qA????1 to quit):Joe Bill Enter the pair of names (A????1q qA????1 to quit): Vic Bill

Enter the pair of names (A????1q qA????1 to quit): Joe Vic Enter the pair of names (A????1q qA????1 to quit): Bill Jane

Enter the pair of names (A????1q qA????1 to quit): Joe James Enter the pair of names (A????1q qA????1 to quit): Vic Jake

Enter the pair of names (A????1q qA????1 to quit): James Rob Enter the pair of names (A????1q qA????1 to quit): Jane Greg

Enter the pair of names (A????1q qA????1 to quit): q q

Your program must read the lines of input and create a linked list. Each node in the linked list has three attributes A????1 first personA????1s name, second personA????1s name and pointer to the next node. So, you would modify the Node class as follows:

public class Node

{

private String first;

private String second;

private Node next; etcA????1

}

Your program should then do the following:

A????1 Print out the names of all people responsible for spreading the cold virus.

In the above example, your program should display

Joe Vic Bill James Jane

A????1 Print out the names of all people NOT responsible for spreading the cold virus, even if they have it themselves.

In the above example, your program should display

Jake Rob Greg

A????1 Given a name s, print the names of all people directly infected by s.

For example, if the given name is Vic, your program should display

Bill Jake

Note: You should print the names only once

Note: You can make appropriate changes to Node.java and LinkedList.java. Save them as Node1.java and LinkedList1.java. You can call your demo program as Virus.java. Submit a zip file containing Node1.java, LinkedList1.java, Virus.java and sample outputs.