Answered step by step
Verified Expert Solution
Question
1 Approved Answer
hello can someone help, why does it give me an error on the output and what should i replace it with ? ArrayBoundedstack.java package queue;
hello can someone help, why does it give me an error on the output and what should i replace it with ?
ArrayBoundedstack.java package queue; import java.util. Scanner; public class Main \{ public static void main(String[] args) \{ ArrayUnboundedQueue drinks = new ArrayUnboundedQueue > (); ArrayUnboundedQueue fruits = new ArrayUnboundedQueue > (); ArrayUnboundedQueue notClassified = new ArrayUnboundedQueue >(); Scanner scanner = new Scanner (System.in); while (true) \{ System.out.print ("Enter a string formatted as D drinkname or F fruitname: "); String input = scanner.nextLine(); if (input. equals ("E end")) \{ break; \} if (input.startswith(" ")) \{ drinks. enqueue(input. substring(2)); \} else if (input.startswith("F ")) \{ fruits.enqueue (input.substring (2)); \} else \{ notClassified. enqueue (input); \} \} System, out. println ("Drink:" tstring,join (" " drinks))i System, out println ("Frujt "string.join(" e fruits) i i \} \} kage queueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started