Question: (Java) Write a main program that will create three queues. The first queue is Hockey, Basketball, Soccer, Baseball, Tennis, Bowling, and the second queue is

(Java) Write a main program that will create three queues. The first queue is "Hockey", "Basketball", "Soccer", "Baseball", "Tennis", "Bowling", and the second queue is "Golf", "Lacrosse", "Pool", and "Swimming". Write a loop that will fill the third queue by emptying the items in the first and second queues by alternating them and putting them into the third queue. When one of the first two queues empties first, then put the remainder of the other queue into the third queue. Thus, for the items above, the third queue will be "Hockey", "Golf", "Basketball", "Lacrosse", and so on. Create a stack and push all of the items in the third queue into that stack.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!