Question: Write a Java program that allows a user to input multiple numbers. Your program should stop accepting words when the user enters STOP. Store
Write a Java program that allows a user to input multiple numbers. Your program should stop accepting words when the user enters "STOP". Store the numbers in an ArrayList. The word STOP should not be stored in the list. o Hint: accept userInput as a String. To convert the userInput to an Integer use this code: Integer.parseInt(userInput) Print the ArrayList range (ArrayList arrayList) this method returns the range of the list. The range is defined as the maximum value minus the minimum value. o code to call the method: System.out.println("Range: range (list)); removeEvens (ArrayList arrayList) this method removes all the even numbers from the list. Make sure to try to enter at least two even numbers in a row code to call the method: removeEvens (list); System.out.println("Evens Removed List: list); Sample Output Please enter numbers, enter STOP to stop the loop. 15 16 18 20 15 17 35 STOP [15, 16, 18, 20, 15, 17, 35] Range: 20 Evens Removed List: [15, 15, 17, 35]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
