Lab 10, Task 1 ------------- original stack: + + | "f" | | "e" | | "a" | | "c" | | "b" | +-----+ calling pop() gives: + + | | | "e" | | "a" | | "c" | | "b" | +-----+ calling push("x") gives: + + | "x" | | "e" | | "a" | | "c" | | "b" | +-----+ calling push("w") gives: + + | "w" | | "x" | | "e" | | "a" | | "c" | | "b" | +-----+ s = pop() assigns "w" to s and gives: + + | "x" | | "e" | | "a" | | "c" | | "b" | +-----+ calling pop() gives: + + | | | "e" | | "a" | | "c" | | "b" | +-----+ calling push("z") gives: + + | "z" | | "e" | | "a" | | "c" | | "b" | +-----+ because s is "w", calling push(s) gives: + + | "w" | | "z" | | "e" | | "a" | | "c" | | "b" | +-----+ 2. See StackClient.java We do not need a type cast for the following line: String str = s1.pop(); because our Stack implementations are generic, and we specify that s1 is a stack of Strings: Stack s1 = new LLStack(); As a result, s1's version of pop() has a return type of String. 3. No, because we can only remove the topmost item in the stack, and "z" is not the topmost item.