package stacks; /** * Test our program by performing a series of operations on stacks, * printing the operations performed, the returned elements and the * contents of the stack involved, after each operation */ public class TestStack { public static void main(String[] args) { Object o; ArrayStack A = new ArrayStack(); A.status("new ArrayStack A", null); //NodeStack A = new NodeStack(); //A.status("new NodeStack A", null); A.push(7); A.status("A.push(7)", null); o=A.pop(); A.status("A.pop()", o); A.push(9); A.status("A.push(9)",null); o=A.pop(); A.status("A.pop()", o); ArrayStack B = new ArrayStack(); B.status("new ArrayStack B",null); //NodeStack B = new NodeStack(); //B.status("new NodeStack B", null); B.push("Bob"); B.status("B.push(\"Bob\")",null); B.push("Alice"); B.status("B.push(\"Alice\")",null); o=B.pop(); B.status("B.pop()",o); B.push("Eve"); B.status("B.push(\"Eve\")",null); } }