Question: Can someone help me with this? Here is the code that is given and the instructions __________________________________________________________________________________________________________________ Main Class: import java.util.LinkedList; import static java.lang.System.*; public
Can someone help me with this? Here is the code that is given and the instructions
__________________________________________________________________________________________________________________
Main Class:
import java.util.LinkedList;
import static java.lang.System.*;
public class Main
{
public static void main ( String[] args )
{
LinkTest test = new LinkTest(new int[]{4,5,6,7,8,9,10,11,12,13});
out.println(test);
test = new LinkTest(new int[]{24,75,86,37,82,94,111,82,43});
out.println(test);
test = new LinkTest(new int[]{0,4,5,2,1,4,6});
out.println(test);
}
}
__________________________________________________________________________________________________________________
LinkTest Class:
import java.util.LinkedList;
import static java.lang.System.*;
public class LinkTest
{
private LinkedList
public LinkTest()
{
list = new LinkedList
}
public LinkTest(int[] nums)
{
list = new LinkedList
for(int num : nums)
{
list.add(num);
}
}
public double getSum( )
{
double total=0;
return total;
}
public double getAvg( )
{
return 0;
}
public int getLargest()
{
int largest=Integer.MIN_VALUE;
return largest;
}
public int getSmallest()
{
int smallest = smallest=Integer.MAX_VALUE;
return smallest;
}
public String toString()
{
String output="";
return output;
}
}
__________________________________________________________________________________________________________________
Instructions:
Lab Goal : This lab was designed to teach you more about a linked list. Lab Description : Write a program that demonstrates that you understand how to use the Java LinkedList class. Sample Data : 4 5 6 7 8 9 10 11 12 13 24 75 86 37 82 94 111 82 43 0 4 5 2 1 46 Sample Output: SUM:: 85.0 AVERAGE:: 8.5 SMALLEST:: 4 LARGEST :: 13 SUM:: 634.0 AVERAGE:: 70.44444444444444 SMALLEST:: 24 LARGEST :: 111 SUM:: 22.0 AVERAGE:: 3.142857142857143 SMALLEST:: 0 LARGEST:: 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
