Question: I am currently learning about LinkedList, and need help completing this lab to make sure I am doing it correct. Any help is appreciated, and

I am currently learning about LinkedList, and need help completing this lab to make sure I am doing it correct. Any help is appreciated, and I will leave a positive review!

I am currently learning about LinkedList, and need help completing this lab

Programs Needed to complete this lab -

ListNode:

public class ListNode implements Linkable { private Comparable listNodeValue; private ListNode nextListNode; public ListNode() { listNodeValue = null; nextListNode = null; } public ListNode(Comparable value, ListNode next) { listNodeValue=value; nextListNode=next; } public Comparable getValue() { return listNodeValue; } public ListNode getNext() { return nextListNode; } public void setValue(Comparable value) { listNodeValue = value; } public void setNext(Linkable next) { nextListNode = (ListNode)next; } }

Linkable:

public interface Linkable { Comparable getValue(); Linkable getNext(); void setNext(Linkable next); void setValue(Comparable value); }

ListFunHouseTwo:

import static java.lang.System.*; public class ListFunHouseTwo { private ListNode theList; public ListFunHouseTwo() { } public void add(Comparable data) { } //this method will return the number of nodes present in list public int nodeCount() { int count=0; return count; } //this method will create a new node with the same value as the first node and add this /ew node at the front of the list. Once finished, the first node will occur twice. public void doubleFirst() { } //this method will create a new node with the same value as the last node and add this /ew node at the end. Once finished, the last node will occur twice. public void doubleLast() { } //method skipEveryOther will remove every other node public void skipEveryOther() { } //this method will set the value of every xth node in the list public void setXthNode(int x, Comparable value) { } //this method will remove every xth node in the list public void removeXthNode(int x) { } //this method will return a String containing the entire list public String toString() { String output=""; return output; } }

ListFunHouseTwoRunner:

import java.util.*; import static java.lang.System.*; public class ListFunHouseTwoRunner { public static void main ( String[] args ) { ListFunHouseTwo funHouse = new ListFunHouseTwo(); funHouse.add("go"); funHouse.add("on"); funHouse.add("at"); funHouse.add("34"); funHouse.add("2.1"); funHouse.add("-a-2-1"); funHouse.add("up"); funHouse.add("over"); out.println("Original list values "); System.out.println(funHouse); out.println(" "); out.println("num nodes = " + funHouse.nodeCount()); out.println(" List values after calling nodeCount "); System.out.println(funHouse); out.println(); funHouse.doubleLast(); out.println(" List values after calling doubleLast "); System.out.println(funHouse); out.println(); funHouse.doubleFirst(); out.println(" List values after calling doubleFirst "); System.out.println(funHouse); out.println(); funHouse.removeXthNode(2); out.println(" List values after calling removeXthNode(2) "); System.out.println(funHouse); out.println(); funHouse.setXthNode(2,"one"); out.println(" List values after calling setXthNode(2,one) "); System.out.println(funHouse); out.println(); } }

A+ Computer Science LINKED LIST IVARS Lab Goal : This lab was designed to teach you more about a linked list and using a linked list in a class as an instance variable data field. Lab Description : Use ListNode to write some basic LinkedList methods. PART 1 - Open the List FunHouse Two.java file and complete the methods in this class. PART 2 - Use the List FunHouseTwoRunner to test your List FunHouseTwo class. ListNode stores a value and a reference to the next node public class ListNode implements Linkable { private comparable listNodeValue; private ListNode nextListNode; EXTENSION : Modify ListNode by adding in a ListNode prevlistNode instance variable / data field. Rewrite the program as a double/circular linked list. public ListNode() { listNodeValue = null; nextListNode = null; } public ListNode (Comparable value, ListNode next) listNodeValue=value; nextListNode=next; } Files Needed :: public Comparable getValue() { return listNodeValue; > ListNode.java Linkable.java List FunHouseTwo.java List FunHouse TwoRunner.java public ListNode getNext() { return nextListNode; } public void setValue (Comparable value) { listNodeValue = value; 3 public void setNext (Linkable next) { nextListNode - (ListNode) next; ) Sample Data : See the main of lab15c. Sample Output : Original list values over up -a-2-1 2.1 34 at on go num nodes - 8 List values after calling nodeCount over up -a-2-1 2.1 34 at on go List values after calling doubleLast over up -a-2-1 2.1 34 at on go go List values after calling doubleFirst over over up-a-2-1 2.1 34 at on go go List values after calling removeXthNode (2) over up 2.1 at go Computer Science -Linked Lists - www.apluscompsci.com List values after calling setXthNode (2, one) over one 2.1 one go A+ Computer Science LINKED LIST IVARS Lab Goal : This lab was designed to teach you more about a linked list and using a linked list in a class as an instance variable data field. Lab Description : Use ListNode to write some basic LinkedList methods. PART 1 - Open the List FunHouse Two.java file and complete the methods in this class. PART 2 - Use the List FunHouseTwoRunner to test your List FunHouseTwo class. ListNode stores a value and a reference to the next node public class ListNode implements Linkable { private comparable listNodeValue; private ListNode nextListNode; EXTENSION : Modify ListNode by adding in a ListNode prevlistNode instance variable / data field. Rewrite the program as a double/circular linked list. public ListNode() { listNodeValue = null; nextListNode = null; } public ListNode (Comparable value, ListNode next) listNodeValue=value; nextListNode=next; } Files Needed :: public Comparable getValue() { return listNodeValue; > ListNode.java Linkable.java List FunHouseTwo.java List FunHouse TwoRunner.java public ListNode getNext() { return nextListNode; } public void setValue (Comparable value) { listNodeValue = value; 3 public void setNext (Linkable next) { nextListNode - (ListNode) next; ) Sample Data : See the main of lab15c. Sample Output : Original list values over up -a-2-1 2.1 34 at on go num nodes - 8 List values after calling nodeCount over up -a-2-1 2.1 34 at on go List values after calling doubleLast over up -a-2-1 2.1 34 at on go go List values after calling doubleFirst over over up-a-2-1 2.1 34 at on go go List values after calling removeXthNode (2) over up 2.1 at go Computer Science -Linked Lists - www.apluscompsci.com List values after calling setXthNode (2, one) over one 2.1 one go

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!