Question: Write a program that creates a String ArrayList. Continually prompt the user for Strings to add to the list until a sentinel value is entered.
Write a program that creates a String ArrayList. Continually prompt the user for Strings to add to the list until a sentinel value is entered. Use an iterator to display all the Strings, then continually ask the user for a String to eliminate until a sentinel value is entered. After each
String is eliminated, display the new list. If the user attempts to continue to eliminate Strings after the list is empty, display an appropriate message, and end the program. Save the file as RemoveWords.java. Notes: Comment the sentinel value when you submit the code.
Also not expressly stated, you may want to check how your code reacts if the String you enter to delete does not exist. Might be a good spot for Exception handling you learned about in chapter
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
