Queue application
Sun May 22 2022 16:47:51 GMT+0000 (Coordinated Universal Time)
Saved by
@ahmed_salam21
/* Write a simple application program that use the utility queue to:
1) insert five elements (10,20,30,40,50)
2) remove from queue two elements
3) display elements in the queue
*/
public class Main {
public static void main(String[] args) {
QueueClass theQueue = new QueueClass(5);
theQueue.insert(10);
theQueue.insert(20);
theQueue.insert(30);
theQueue.insert(40);
theQueue.insert(50);
theQueue.remove();
theQueue.remove();
// display elements in the queue
while (!theQueue.isEmpty()) {
int elements = theQueue.remove();
System.out.print(elements);
System.out.print(" ");
}
}
}
// Output : 30 40 50
content_copyCOPY
Comments