Question: Declare variable widthList as a LinkedList of type Integer. Read integer numIterations from input. For numIterations iterations, insert integers 2 4 and 4 9 into
Declare variable widthList as a LinkedList of type Integer. Read integer numIterations from input. For numIterations iterations, insert integers and into widthList, in that order.
Ex: If the input is then the output is:
import java.util.Scanner;
import java.util.LinkedList;
public class MakeWidthList
public static void mainString args
Scanner scnr new ScannerSystemin;
int numIterations;
int i;
Variable declarations go here
Your code goes here
Traversing a list using indexes
for i ; i widthList.size; i
System.out.printwidthListgeti;
System.out.println;
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
