Question: Data Structures & Algorithms Write a Java program that repeatedly prompts the user to enter strings, using the string E end to indicate when finished.
Write a Java program that repeatedly prompts the user to enter strings, using the string "E end" to indicate when finished. The user is assumed to only enter strings of the form "F fruitname" or "D drinkname". Output the names that had "D" indicated in the same order they were entered, preceded by the string "Drink: " and then do the same for the names that had "F" indicated, preceded by the string "Fruit : ". anything else keep them in the original queue and output them, preceded by the string "Not Classified : ".. Use ArrayUnboundedQueue objects in your program. Sample Run: D run: W Enter a String formatted as D drinkname or F fruitname : D water Enter a string formatted as D drinkname or F fruitname : F banana Enter a String formatted as D drinkname or F fruitname : F apple Enter a string formatted as D drinkname or F fruitname : D coffee Enter a string formatted as D drinkname or F fruitname : s book Enter a string formatted as D drinkname or F fruitname : D tea Enter a String formatted as D drinkname or F fruitname : S pen Enter a String formatted as D drinkname or F fruitname : F oragne Enter a string formatted as D drinkname or F fruitname : E end Drink : water coffee tea Fruit : banana apple oragne Not Classified :book pen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
