Question: Four integers are read from input and added to the tail of Integer Deque seatNumbers. Remove and output three integers, matching the order of the
Four integers are read from input and added to the tail of Integer Deque seatNumbers. Remove and output three integers, matching the order of the first three lines of the example output. End each output with a newline.
Ex: If the input is then the output is:
Removed:
Removed:
Removed:
Remaining seat:
import java.util.LinkedList;
import java.util.Deque;
import java.util.Scanner;
public class SeatNumbers
public static void mainString args
Scanner scnr new ScannerSystemin;
Deque seatNumbers new LinkedList;
int i;
for i ; i ; i
seatNumbers.addLastscnrnextInt;
Your code goes here
System.out.printlnRemaining seat: seatNumbers.peekFirst;
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
