For the next problems write a client to test the following methods. Check out th

For the next problems write a client to test the following methods. Check out th.

For the next problems write a client to test the following methods. Check out the lecture notes(attached) for thenecessary files(StackADT.java, LinkedStackClass.java, QueueADT.java, QueueClass.java,QueueException.java, QueueOverflowException.java, andQueueUnderflowException.java.) 
1. (Method: printBackStack) Task: Display the contents of a stack in reverse order (top to bottom),leaving the stack unchanged.
SOLUTION:
public static void printBackStack(LinkedStackClass

intStack) { …}2. (Method: printStack) Task: Display the contents of a stack in direct order (bottom to top), leaving

the stack unchanged.

SOLUTION:

public static void printStack(LinkedStackClass

intStack) { …}3. (Method: getSecond) Task: Find the second item in a stack, leaving the stack unchanged.

SOLUTION:

public static Integer getSecond(LinkedStackClass

intStack) { …}

4. (Method: countItems) Task: Count the number of items in a stack, leaving the stack unchanged.SOLUTION:

public static int countItems(LinkedStackClass

intStack) { …}5. (Method: removeItem) Task: Delete every occurrence of a specified item from a stack, leaving the

order of the remaining items unchanged.

SOLUTION:

public static void removeItem(LinkedStackClass

intStack, Integer n) { …}

6. (Method: reverseStack) Task: Reverse a stack, using a queue. The original stack is lost.SOLUTION:

public static void reverseStack(LinkedStackClass

s) { QueueClass

q = new QueueClass

(); …}7. (Method: reverseQueue) Task: Reverse a queue, using a stack. The original queue is lost.

SOLUTION:

public static void reverseQueue(QueueClass

q){ LinkedStackClass

s = new LinkedStackClass

(); …}8. (Method: printQueue) Task: Display the contents of a queue in direct order, leaving the queue

unchanged.

SOLUTION:

public static void printQueue(QueueClass

q) { …}

SAMPLE OUTPUT:

Enter integers (999 to stop): 25 10 15 10 20 37 10 59 21 10 27 20 4 2 10 53 47 37 5977 27 20 10 999The original stack printed in direct order (bottom to top) is:25 10 15 10 20 37 10 59 21 10 27 20 4 2 10 53 47 37 59 77 27 20 10The stack printed in reverse order (top to bottom) is:10 20 27 77 59 37 47 53 10 2 4 20 27 10 21 59 10 37 20 10 15 10 25The stack stores 23 items.The top is: 10The second item (below top) is: 20Enter value to be removed from stack: 10The stack after removing every occurrence of 10 is:25 15 20 37 59 21 27 20 4 2 53 47 37 59 77 27 20Reversed the stack. The new stack printed in direct order is:20 27 77 59 37 47 53 2 4 20 27 21 59 37 20 15 25The queue is:3 6 9 12 15 18 21 24 27 30The reversed queue is:30 27 24 21 18 15 12 9 6 3











For the next problems write a client to test the following methods. Check out th

[opskill_register_order]

"Looking for a Similar Assignment? Order now and Get a Discount!

Hey, wait!You Don't want to miss this offer!

Before you go, let us offer you a 20% discount coupon for your next purchase.