Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, I have to write 2 Methods 1 Method to insert a Node at a position, and 1

ID: 3545846 • Letter: H

Question

Hello, I have to write 2 Methods 1 Method to insert a Node at a position, and 1 Method to insert a Node at the End of the list


My project is composed of a LinkedList Class and a CharNode Class and a Test Class which creates the nodes and passes them to the LinkedList class


-----------------------------------------Test Class-------------------------------------------




public class Test {

public static void main(String[] args) {

IListCharNodes list = new ListCharNodes();
ICharNode n1 = new CharNode('a',1);
ICharNode n2 = new CharNode('b',0);
ICharNode n3 = new CharNode('a',2);
ICharNode n4 = new CharNode('b',-1);

list.insertCharNode(n1);
list.insertCharNode(n4);
list.insertCharNode(n3);
list.insertCharNode(n2);
System.out.print("Message 1 ");
list.printMessage();
System.out.println(" is interesting or not "+ list.isPalindrome());

list = new ListCharNodes();
list.insertCharNode(n4);
list.insertCharNode(n1);
list.insertCharNode(n3);
list.insertCharNode(n2);
System.out.print("Message 2 ");
list.printMessage();
System.out.println(" is interesting or not "+ list.isPalindrome());
}
}


------------------------------------------------List Class---------------------------------------


public class ListCharNodes implements IListCharNodes {

private int length;
private ICharNode firstNode;
private String message;

public ICharNode getFirstNode(ICharNode node) {

return firstNode;

}

public int getLength() {

return length;
}


public void insertCharNode(ICharNode node) {


}

public void insertCharNodeAtEnd(ICharNode node) {

}


public boolean isPalindrome() {

return false;
}


public void printMessage() {

}

}
--------------------------------------Node Class-------------------------------------


public class CharNode implements ICharNode {

private int index;
private char content;
private ICharNode temp;


public CharNode(char c, int i) {
setContent(c);
setIndex(i);
}

public void setContent(char c) {

content = c;

}


public char getContent() {

return content;
}

public void setIndex(int i) {

index = i;

}

public int getIndex() {

return index;
}

public void setNext(ICharNode next) {


}


public ICharNode getNext() {

return temp.getNext();
}



}



Explanation / Answer

CODE TO ADD NODE AT END OF LIST

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote