Question: 1. (8 pts.) The following stack stores a stack of integers. You must draw the stacks for full credit and then determine the output of

 1. (8 pts.) The following stack stores a stack of integers.You must draw the stacks for full credit and then determine the

1. (8 pts.) The following stack stores a stack of integers. You must draw the stacks for full credit and then determine the output of the following program. import java.util. *; public class TestStack1 { public static void main(String { args) Stack s= new Stack0; s.push(-63); s.push(35); s.push(29); System.out.println(s.pop(); Integer v= s.popO-s.popO % 3; s.push(v); s.push(48); int w=s.pop(); int x = s.pop(); s.push(x % w+ v); System.out.println(s.pop(); Integer a=-5, b=17, c=13, d=21; s.push(a); s.push(b); s.push(c); s.push(d); s.push(s.popO + s.popO); s.push(s.popO/ s.popO); while(!s.empty()) } Output: 2. (2 pts. each) Fill in the blanks to complete the method definition. //returns the bottom element of the specified stack public static E bottom (Deque stack) { Deque stackl = new while (!stack.isEmpty() { stack1. } E X = stack1. while (!stack1.isEmpty()) { stack. } return 1. (8 pts.) The following stack stores a stack of integers. You must draw the stacks for full credit and then determine the output of the following program. import java.util. *; public class TestStack1 { public static void main(String { args) Stack s= new Stack0; s.push(-63); s.push(35); s.push(29); System.out.println(s.pop(); Integer v= s.popO-s.popO % 3; s.push(v); s.push(48); int w=s.pop(); int x = s.pop(); s.push(x % w+ v); System.out.println(s.pop(); Integer a=-5, b=17, c=13, d=21; s.push(a); s.push(b); s.push(c); s.push(d); s.push(s.popO + s.popO); s.push(s.popO/ s.popO); while(!s.empty()) } Output: 2. (2 pts. each) Fill in the blanks to complete the method definition. //returns the bottom element of the specified stack public static E bottom (Deque stack) { Deque stackl = new while (!stack.isEmpty() { stack1. } E X = stack1. while (!stack1.isEmpty()) { stack. } return

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!