Question: 3. Fill in the code to perform the tasks specified by the comments in the SListTester.java class. (1 point each) a. Create an Object of
3. Fill in the code to perform the tasks specified by the comments in the SListTester.java class. (1 point each)
a. Create an Object of the SList class.
b. Insert the following integer numbers in the list using the addFirst method.
{2, 3, 4, 7, 9}
c. Print the elements in the linked list.
d. Insert the following integer numbers in the list using the addLast method.
{15, 7, 12, 8, 10}
e. Print the elements in the linked list.
f. Remove the first element from your linked list.
g. Print the elements in the linked list.
h. Print the number of elements in the linked list (size).
i. Print the index (position) of the first occurrence of (7) using the findIndex method from 1.a
j. Print the index (position) of the first occurrence of (25) using the findIndex method from 1.a
k. Remove the last element from your linked list.
l. Print the elements in the linked list.
SListTester.java :
public class SListTester
{
public static void main (String [] args)
{
//Create an Object of the SList class
//Insert the following elements in the list using addFirst
// 2, 3, 4, 7, 9
//Print the elements in the linked list
//Insert the following elements in the list using addLast
// 15, 7, 12, 8, 10
//Print the elements in the linked list
//Remove the first element from your linked list
//Print the elements in the linked list
//Print the number of elements in the linked list (Size)
//Print the index (position) of the first occurrence of (7) using the findIndex method
//Print the index (position) of the first occurrence of (25) using the findIndex method
//Remove the last element from your linked list
//Print the elements in the linked list
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
