Question: Description Q3) Removing the Smallest Your task is the following: 1. Read in integers from the user and store them in some collection until



Description Q3) Removing the Smallest Your task is the following: 1. Read in integers from the user and store them in some collection until a value of -1 is entered. The -1 entered should not be included in the collection. 2. Print out the collection containing all the values entered by the user. 3. Remove the smallest element from the collection. 4. Print out the collection containing all the values entered by the user with the smallest value removed. You are able to add methods to help you achieve this task however they are not necessary. The only requirement is that when you hit the Run button, your program executes according to the above functionality requirements. You can assume that the user will always enter 2 or more values. The following is an example input and output of this in action (text in bold and italics is an example of user input): Workspace Description 3 6 2 8 4 -1 [3, 6, 2, 8, 4] [3, 6, 8, 4] and another example: 0 1 2 3 4 5 6 -1 [0, 1, 2, 3, 4, 5, 6] [1, 2, 3, 4, 5, 6] Hints: Workspace + Runner.java 1 import java.util.Scanner; 2 import java.util.LinkedList; 3 import java.util.ArrayList; 4 import java.util.List; 5 6 public class Runner { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList list = new ArrayList (); // Your code goes here! 7 8 9 10 11 12 } 13 home/Runner.java Spaces: 4 (Auto) Console All changes saved Run Mark
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
