Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data Structures & Algorithms Write a Java program that repeatedly prompts the user to enter strings, using the string E end to indicate when finished.

Data Structures & Algorithms
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions