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 46149469, then the output is:
Removed: 69
Removed: 46
Removed: 94
Remaining seat: 14
import java.util.LinkedList;
import java.util.Deque;
import java.util.Scanner;
public class SeatNumbers {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
Deque seatNumbers = new LinkedList();
int i;
for (i =0; i <4; ++i){
seatNumbers.addLast(scnr.nextInt());
}
/* Your code goes here */
System.out.println("Remaining seat: "+ seatNumbers.peekFirst());
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!