Stack exercises

  1. 4/26 Exercises: Download Stacks.jar and use a decompression program such as 7-zip to extract the files to a directory, then open the directory as a project in BlueJ. Review the StackInterface to see the methods that can be called on a stack object (which can be constructed using StackArrayBased or StackReferenceBased). Read and understand the following examples:
  2. 5/1 Exercise: Define a class Calculator with a method evaluatePostfix that receives as a parameter a String (each character of which is a single-digit integer operand or a binary operator: +, -, * or /, in postfix form) and returns an integer representing the result of evaluating the expression. For example, if the input parameter is "234+*" then the method should return 14. Refer your notes/slides or book/handout re: evaluating a postfix expression, and the palindrome example (to see how to work with a stack of characters).