Question: Use Java. Thank you. 2) Queues and stacks: Given a stack s: Top 12 42 36 Bottom Write a roll method that rolls a stack
Use Java. Thank you.

2) Queues and stacks: Given a stack s: Top 12 42 36 Bottom Write a roll method that "rolls" a stack down so that the last element (bottom) of stack becomes the top of the stack and the other elements are pushed down one position. (10 pts) Before Roll: After Roll: 42 5 36 36 12 42 Your method should be tested with the stack s defined above Print the stack before and after calling your roll methods. This method should use the API of the Stack class only. You may not access the underlying storage of the stack or use iterators or the remove method. You MAY use an intermediate data structure The ro11 should be in place-your method should not return a new stack In your test submission file include: Your "Rollstac code showing your Rollstack class, which in turn contains the main method and the method that rolls the stack. Include your console output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
