// Name: // Lab Section: // Primary TA: // Email: // Date: // CS101 Lab 8 // IntStack.java /* * Instructions * Decide whether IntStack should extend Stack * If it does, delete those methods that you have in Stack * Implement the methods for this class and test them */ import cs101.terminal.*; public class IntStack { public IntStack() { } public boolean isEmpty() { return true; } public void push(int n) { } public Integer popInteger() { return null; } public int getTop() { throw new Error("getTop not implemented yet!"); } public void add() { } public void mpy() { } public void neg() { } public void sub() { } public void dup() { } public void prt() { } public String toString() { return "fill me in or delete me"; } public static void selfTest() { IntStack is = new IntStack(); is.push(1); is.prt(); is.push(27); is.prt(); is.push(2); is.prt(); is.sub(); is.prt(); is.dup(); is.prt(); is.add(); is.prt(); is.push(2); is.prt(); is.mpy(); is.prt(); is.add(); is.prt(); is.prt(); is.add(); // will cause stack underflow } public static void main(String args[]) { selfTest(); } }