Please i NEED your help to complete this class class IntNode { private int data;
ID: 3651933 • Letter: P
Question
Please i NEED your help to complete this class
class IntNode
{
private int data;
private IntNode link;
public IntNode(int initialData, IntNode initialLink)
{
data = initialData;
link = initialLink;
}
public int getData( ) { return data; }
public IntNode getLink( ) { return link; }
public void setData(int newData) { data = newData; }
public void setLink(IntNode newLink) { link = newLink; }
}//IntNode
public class PracticeWithLinkedLists
{
public static void main(String[ ] args)
{
IntNode head = null;
IntNode tail = null;
// 1.) Insert a node with data 100 into this empty list.
// 2.) Insert a node with data 200 at the beginning of the list.
// 3.) Insert a node with data 300 at the end of the list.
IntNode cursor = null;
// The list now has three nodes. Move the cursor to the middle node.
// 4.) Insert a node with data 400 after the cursor (but don't move the cursor).
// The list should now be [200, 100, 400, 300], with the
// cursor still pointed at the node containing 100.
// 5.) Delete the node pointed to by the cursor. Then nullify the cursor.
// 6.) Delete the first node in the list (the one containing 200).
// 7.) Delete the last node in the list (the one containing 300).
// 8.) Delete the single remaining node from the list (the one containing 400).
// Make sure that head and tail are both null.
if ( (head != null) || (tail != null) )
System.out.println("You did something wrong.");
}//main()
}//PracticeWithLinkedLists