Fundamentals of Computer Science II (CSC-152 99S)


Laboratory: Stacks

This laboratory is under development.

In this laboratory session, you will investigate a node-based implementation of stacks. You will begin by considering the basic operations (add, remove, peek). You will then implement a toString method to improve testing.

Required files:


Node-Based Stacks

  1. Copy all the above files.
  2. Compile them.
  3. Run the tester. Does the Stack class seem to work the way you expect?
  4. Add a toString method to the NodeBasedStack class.
  5. Verify that it works.

Array-Based Stacks

  1. Create an ArrayBasedStack class using stubs for all the methods.
  2. Verify that it compiles.
  3. Write an ArrayBasedStackTester class (which you should base on NBSTester.java).
  4. Verify that it compiles and executes.
  5. Add a constructor to your ArrayBasedStack.
  6. Add a toString method to your ArrayBasedStack class.
  7. Add an add method to your ArrayBasedStack class.
  8. Verify that it works using the tester.
  9. Add a peek method.
  10. Verify that it works using the tester.
  11. Add a remove method.
  12. Verify that it works using the tester.

History


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/99S/Labs/stacks.html

Source text last modified Wed Apr 14 11:41:21 1999.

This page generated on Wed Apr 14 11:59:16 1999 by SiteWeaver. Validate this page's HTML.

Contact our webmaster at rebelsky@math.grin.edu