Question: Can someone help me? ________________________________________________________________________________________________________ Main Class: import java.util.*; import static java.lang.System.*; public class Main { public static void main ( String[] args ) {
Can someone help me?
________________________________________________________________________________________________________
Main Class:
import java.util.*;
import static java.lang.System.*;
public class Main
{
public static void main ( String[] args )
{
ListNode z = new ListNode("go",
new ListNode("on",
new ListNode("at",
new ListNode("34",
new ListNode("2.1",
new ListNode("-a-2-1",
new ListNode("up",
new ListNode("over",null))))))));
out.println("Lab15b Test Code ");
out.println("Original list values ");
ListFunHouse.print(z);
out.println(" ");
out.println("num nodes = " + ListFunHouse.nodeCount(z));
out.println(" List values after calling nodeCount ");
ListFunHouse.print(z);
out.println();
ListFunHouse.doubleFirst(z);
out.println(" List values after calling doubleFirst ");
ListFunHouse.print(z);
out.println();
ListFunHouse.doubleLast(z);
out.println(" List values after calling doubleLast ");
ListFunHouse.print(z);
out.println();
ListFunHouse.removeXthNode(z,2);
out.println(" List values after calling removeXthNode(2) ");
ListFunHouse.print(z);
out.println();
ListFunHouse.setXthNode(z,2,"one");
out.println(" List values after calling setXthNode(2,one) ");
ListFunHouse.print(z);
out.println();
}
}
_____________________________________________________________________________________________________________
Linkable Class:
public interface Linkable
{
Comparable getValue();
Linkable getNext();
void setNext(Linkable next);
void setValue(Comparable value);
}
__________________________________________________________________________________________________________________
ListFunHouse Class:
import static java.lang.System.*;
public class ListFunHouse
{
//this method will print the entire list on the screen
public static void print(ListNode list)
{
}
//this method will return the number of nodes present in list
public static int nodeCount(ListNode list)
{
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 to the list. Once finished, the first node will occur twice.
public static void doubleFirst(ListNode list)
{
}
//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 static void doubleLast(ListNode list)
{
ListNode prev=null;
}
//method skipEveryOther will remove every other node
public static void skipEveryOther(ListNode list)
{
}
//this method will set the value of every xth node in the list
public static void setXthNode(ListNode list, int x, Comparable value)
{
int count=1;
}
//this method will remove every xth node in the list
public static void removeXthNode(ListNode list, int x)
{
int count=1;
}
}
__________________________________________________________________________________________________________________
ListNode Class:
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;
}
}
__________________________________________________________________________________________________________________
Instructions:

Lab Goal : This lab was designed to teach you more about a linked list and passing a linked list as a parameter. Lab Description: Use ListNode to write some basic LinkedList methods. PART 1 - Open the List Pun House.java file and complete the methods in this class. PART 2 - Use lab15b.java to test your ListFun House class. ListNode stores a value and a reference to the next node public clar de impact Links Files Needed: Private Compare to: Private Listado LastNode.java pahli Lin Historie mit Linkable Java Xode - ListPunhouse.java Labisbjava patto Costale value, toda next) stalo public comparable etaith return to 1 public Ladegetect 04 rutier raxtlistede public road acceperable value 1st mc pahli muid at Linkit Sample Data : See the main of 115b Sample Output: 90. at 34 2.18-2-1 som modes Liat atat in modeCount Lista talling dobit 99 99 2.1 List alates selling dobilat so get 42.1---2-1 VE VE Lististas calling om de 23 34-2-3- A+ Computer Science -Linked Lists - www.npluscompci.com text valesttet selling de (2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
