Question: import java.util.Scanner; public class PoD { public static void main( String [] args ) { Scanner in = new Scanner( System.in ); LinkedList teamList =

 import java.util.Scanner; public class PoD { public static void main( String

[] args ) { Scanner in = new Scanner( System.in ); LinkedList

import java.util.Scanner;

public class PoD

{

public static void main( String [] args )

{

Scanner in = new Scanner( System.in );

LinkedList teamList = new LinkedList();

final int TEAM_SIZE = Integer.valueOf(in.nextLine());

for (int i=0; i

{

String newTeamMember = in.nextLine();

teamList.append(newTeamMember);

}

while (in.hasNext())

{

String removeMember = in.nextLine();

teamList.remove(removeMember);

}

System.out.println("FINAL TEAM:");

System.out.println(teamList);

in.close();

System.out.print("END OF OUTPUT");

}

}

===========================================================================================

import java.util.NoSuchElementException;

/**

* A listnked list is a sequence of nodes with efficient element

* insertion and removal. This class contains a subset of the methods

* of the standard java.util.LinkedList class.

*

* You will finish off the contains method.

*/

public class LinkedList

{

//attributes

private Node head;

private Node tail;

//Node

class Node

{

public Object data;

public Node previous;

public Node next;

}

/**

* Constructs an empty linked list/

*/

public LinkedList()

{

head = null;

tail = null;

}

/**

* @method removeHead()

* @param Object : object to be removed

* @returns void

*

* Removes node from the linked list

*/

public void remove(Object data)

{

//PLEASE START WORK HERE

//===============================================

//===============================================

//PLEASE END WORK HERE

}

/**

* Appends a new node to the end of the linked list.

*/

public void append(Object element)

{

if (head == null) //Empty linked list

{

Node firstNode = new Node();

firstNode.data = element;

firstNode.previous = null;

firstNode.next = null;

head = firstNode;

tail = firstNode;

}

else //At least one node already exists.

{

Node newNode = new Node();

newNode.data = element;

newNode.previous = tail;

newNode.next = null;

tail.next = newNode;

tail = newNode;

}

}

public String toString()

{

Node position = head;

String output = "";

while (position != null)

{

output += position.data + " ";

position = position.next;

}

return output;

}

}

The following are details of the new remove method. All other input/output and processing of PoD.java are handled for you Input The remove method takes in an object from the linked list as input Processing Complete the contains method in the LinkedList class. Details of this are provided in the Java file at left Output The remove method returns void. Output in PoD.java is taken care of for you. If the person whose name is being checked against the team roster is on the list (i.e contained in the linked list), it is removed fromm the list and PoD java outputs the team after removal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!