Question: Must be in JAVA language Integer cabinetCount is read from input as the number of input values that follow. The node headCabinet is created with
Must be in JAVA language
Integer cabinetCount is read from input as the number of input values that follow. The node headCabinet is created with the string "color". Use scnrnext to read cabinetCount strings. Insert a CabinetNode for each string at the end of the linked list.
Ex: If the input is scarlet lavender, then the output is:
color
scarlet
lavender
import java.util.Scanner;
public class CabinetLinkedList
public static void mainString args
Scanner scnr new ScannerSystemin;
CabinetNode headCabinet null;
CabinetNode currCabinet null;
CabinetNode lastCabinet null;
int cabinetCount;
String inputValue;
int i;
cabinetCount scnrnextInt;
headCabinet new CabinetNodecolor;
lastCabinet headCabinet;
Your code goes here
currCabinet headCabinet;
while currCabinet null
currCabinet.printNodeData;
currCabinet currCabinet.getNext;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
