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

Objective: The goal of this assignment is to practice the creation and traverse

ID: 3617263 • Letter: O

Question

Objective: The goal of this assignment is to practice the creation and traverse of linked lists.

Goal: To write a program that creates and prints a linked list containing the strings "Alice", "Ben", "Stacie", "Kevin", "Joe", "Stephanie" and "Charles" in this order. The list needs to be printed as an HTML file. The program is required to have the following:

·         <UL>

·         <LI>Alice</LI>

·         <LI>Ben</LI>

import

public

String

Node

//default constructor

public

}

Scanner input=

Node first,last,newNode;

first=

last=

String name;

System.

name=input.next();

newNode=

newNode.

newNode.

first=newNode;

last=newNode;

}

last.

last=newNode;

}

name=input.next();

}

}

Node current;

current=first;

{

System.

current=current.

}

}

}

Explanation / Answer

import java.util.*; public class StringNode {     private static LinkedList list= new LinkedList();     private String value;         //Default Constructor     StringNode() {             }         //Parameter Constructor     StringNode(String input) {         value = input;     }         public LinkedListbuildLinkedListForward() {         StringNode node = newStringNode(value);         list.add(node);         return list;     }         public void setValue(String input) {         value = input;     }         public String toString() {         return value;     }     public void printHTMLList() {         if (!list.isEmpty()) {            System.out.println("
    ");            while(list.peek() != null) {                System.out.println("
  • " + list.poll() +"
  • ");             }            System.out.println("
");         }     }         public static void main(String[] args) {         if (args != null &&args.length != 0) {             StringNodenode = new StringNode();                         for(int i= 0; i